属性绑定v-bind

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    
</head>
<body>
    <div id = "app1">
        <div>
            <a v-bind:href="url">百度</a>
            <button v-on:click="handle">切换</button>
        </div>
        
    </div>
    <script src="vue.js"></script>
    <script>
        var vue1 = new Vue({
            el: '#app1',
            data:{
                url:'http://www.baidu.com'
            },
            methods:{
                handle:function(){
                    this.url='http://www.xiaomi.com'
                }
            }
        })
    </script>
</body>
</html>

v-model底层用到了v-bind属性绑定和v-on事件绑定

posted on 2020-08-01 17:33  知否知否,  阅读(106)  评论(0编辑  收藏  举报