• Vue笔记1


    index.html

    <!DOCTYPE html>
    <html>
    
        <head>
            <meta charset="UTF-8">
            <title></title>
            <script src="vue.js" type="text/javascript" charset="UTF-8"></script>
    
        </head>
    
        <body>
            <div id="app">
                {{ message }} {{name}} {{age}}
                <div v-html="html">
                    {{ html }}
                </div>
                <span v-bind:class="color">颜色</span>
                
                {{ number + 1 }}
                {{ 1==1 ? 'YES' : 'NO' }}
                {{ message.split('').reverse().join('') }}
                
                <p v-if="seen">v-if</p>
                <div @click="click1">
                    <div @click.stop="click2">
                        click me
                    </div>
                </div>
            </div>
    
            <script type="text/javascript">
                var data = {
                    message: 'Hello Vue!',
                    name: 'ffff',
                    age: 12,
                    html: "<span style='color:red'>红色</span>",
                    color: '',
                    number:10,
                    seen:true
                }
                var app = new Vue({
                    el: '#app',
                    data: data,
                    methods:{
                        click1:function(){
                            console.log("click1");
                        },
                        click2:function(){
                            console.log("click2");
                        }
                    },
                    beforeCreate: function() {
                        console.log("beforeCreate");
                    },
                    created: function() {
                        console.log("created");
                    },
                    beforeMount: function() {
                        console.log("beforeMount");
                    },
                    mounted: function() {
                        console.log("mounted");
                    },
                    beforeUpdate: function() {
                        console.log("beforeUpdate");
                    },
                    updated: function() {
                        console.log("updated");
                    }
    
                })
                data.name = '123'
                data.age = '18'
                app.$data.name = 'victor'
                app.$watch('age', function(newVal, oldVal) {
                    console.log(newVal + " " + oldVal);
                })
                app.$data.age = '28'
                app.$data.color = 'red'
            </script>
    
            <style type="text/css">
                .red {
                    color: red;
                }
            </style>
        </body>
    
    </html>
  • 相关阅读:
    python import语句
    python输出中文
    python字典的格式化字符串
    emacs查找替换
    emacs书签
    [转]Ubuntu11.10 更改登录界面背景(LightDM背景)
    ubuntu samba共享文件
    emacs笔记
    .NET登录验证码实现
    WEB标准学习实践(一)
  • 原文地址:https://www.cnblogs.com/zhuawang/p/11535357.html
Copyright © 2020-2023  润新知