1160

[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

你可能感興趣的文章

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

vue js 與teleport vue js 與 teleport 範例 <!DOCTYPE html> <html> <

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

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

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

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

隨機好文

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

apache 反向代理 80轉443轉8080 apache, proxy pass

ArrayList 想移除特定值 想移出water, 使用lambda 的方式如下 List<String> fruits = new Arr

臺中市雲端校務系統與Windows AD帳號整合(2) 安裝Active Directory網域服務

臺中市雲端校務系統與Windows AD帳號整合(5) 安裝java環境

精讚::