美文网首页
2019-04-07

2019-04-07

作者: Gorgine | 来源:发表于2019-04-07 22:23 被阅读0次

    Vue学习笔记

    <!DOCTYPE html>
    <html>
    <head>
        <title></title>
        <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
    </head>
    
    <div id="app">
        {{ message }}
    </div>
    
    <div id="app1">
        <span v-if='seen'>Can u see me?</span>
    </div>
    
    <div id="app2">
        <span v-for='msg in msgs'>
            {{ msg.text }}
        </span>
    </div>
    
    <div id="app4">
        <button v-on:click='reverseMessage'>{{ message }}</button>
    </div>
    
    
    <div id="app5">
        <span>{{ message }}</span>
        <input v-model='message'>
    </div>
    
    
    
    <script type="text/javascript">
        var app = new Vue({
            el: '#app',
            data: {
                message: 'Vue start up!'
            }
        })
        var app1 = new Vue({
            el: '#app1',
            data: {
                seen: 'true'
            }
        })
    
        var app2 = new Vue({
            el: '#app2',
            data: {
                msgs: [
                {text: 'hello vue'},
                {text: 'hello hgj'},
                {text: 'hello css'},
    
                ]
            }
        })
        var app4 = new Vue({
            el: '#app4',
            data: {
                message: 'hit me to reverse this message'
            },
            methods: {
                reverseMessage: function (){
                    this.message = this.message.split('').reverse().join('')
                }
            }
        })
    
        var app5 = new Vue({
            el: '#app5',
            data: {
                message: 'you input, i show it'
            }
        })
    
    </script>
    </body>
    </html>
    
    

    相关文章

      网友评论

          本文标题:2019-04-07

          本文链接:https://www.haomeiwen.com/subject/gdweiqtx.html