[精讚] [會員登入]
666

[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

你可能感興趣的文章

word題目轉google測驗 word題目轉google測驗

[vue.js] 動態的props 做parent-child components 雙向綁定 vue.js props components camel-case

axios vuejs application/x-www-form-urlencoded 送資料 VUE.JS 以 application/x-www-form-urlencoded 送資料

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

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

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

我有話要說

>>

限制:留言最高字數1000字。 限制:未登入訪客,每則留言間隔需超過10分鐘,每日最多5則留言。

訪客留言

[無留言]

隨機好文

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

Arrays.asList 後想再add出現 UnsupportedOperationException 這個問題真是搞死我了 List<String> fruits = Arrays.asList("a

雲端校務系統與OPENLDAP帳號整合(2) openldap,雲端校務

[shell script] 批次判斷domain name 正解設定 判斷dns 正解設定

使用vbs設定windows 10 靜態IP setting static ip Set Adapter = GetObject("winmgmts:Win