[精讚] [會員登入]
878

[vue.js] input event

Form-Input-Components-using-Custom-Events

分享此文連結 //n.sfs.tw/10337

分享連結 [vue.js] input event@igogo
(文章歡迎轉載,務必尊重版權註明連結來源)
2019-10-23 04:24:25 最後編修
2016-12-01 23:14:52 By igogo
 

 

Custom events can also be used to create custom inputs that work with v-model

<input v-model="something">

is just syntactic sugar for:

<input v-bind:value="something" v-on:input="something = $event.target.value">

v-model 可以直接做資料的雙向綁定, 它其實是input event 的語法糖

 

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>    demo</title>
        <script src="//unpkg.com/vue/dist/vue.js"></script>
    </head>
    <body>
        <div id='vm'>
            <br/>
            <span :style="{color: activeColor}">{{article}}</span>
            <br/>
            {{msg}}
            <br/>
            <input v-model="msg" placeholder="edit me">
            <input v-bind:value="msg" v-on:input="msg = $event.target.value">

        </div>
        <footer>
            <script>
                var vm = new Vue({
                
                    el: "#vm",
                    data:{
                        'msg':'hello',
                        'article':'閱讀習慣改變,又一家老書局明年熄燈',
                        activeColor: 'blue',
                    }
                
                })
            </script>
        </footer>
        <?php
                print " ";
        ?>
    </body>
</html>
END

你可能感興趣的文章

[javascript] 將角色物件放到清單中,並依序讀出每個角色的X值 參考在scratch中建立三個角色並且給定值 http://n.sfs.tw/content/index/14716 一

vue.js modal 作兩個選項按鈕並導向不同頁面 vue.js modal 作兩個選項按鈕

vue.js components 多個組件的呈現 vue.js 組件 component

將google試算表當作簡易資料庫,利用Google apps cript 在網頁上操作查詢 將google試算表當作簡易資料庫,利用apps cript 在網頁上操作查詢 若我有一試算表資料 縣市 status

vue.js component 在parent與child 傳值 component 在parent與child 傳值

[vue.js] input event Form-Input-Components-using-Custom-Events

隨機好文

java-身份証字號驗証 FormatCheck.java public class FormatCheck { private volatile

vue.js components 多個組件的呈現 vue.js 組件 component

java.time 時間 instant java.time

找尋多個文件夾中最新檔案(jpg,png,txt)並複製到nexus資料夾 找尋多個文件夾中最新檔案(jpg,png,txt)並複製到集中資料夾

雲端校務系統與OPENLDAP帳號整合(1) 本文件目標是為做單一帳號整合, 使用校端更改密碼服務, 將雲端校務系統的帳密同步至校內LDAP server, 並讓SA