vue属性绑定和双向数据绑定

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>属性绑定和双向数据绑定</title>
    <script src="Vue.js"></script>
</head>
<body>
<div id="root">
    <!--使用:或者v-bind: 让div属性的值指向vue中data的数据源-->
    <!--属性绑定  1. v-bind: 2 :-->
    <div :title="'deal li'+title">
        hello world
    </div>
   <!--双向绑定-->
    <input v-model  ="content"/>

    <div>{{content}}</div>
</div>
<script>
    new Vue(
        {
            el:"#root",
            data:{
                title:"this is hello world",
                content:"this is content"
            }
        }
    )
</script>
</body>
</html>

猜你喜欢

转载自www.cnblogs.com/topsyuan/p/11706298.html