强制绑定

1、案例1

<!DOCTYPE html>
<html>

<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>强制绑定</title>
</head>

<body>
    <div id="app">
        <!--v-bind:可直接缩写为:-->
        <img v-bind:src="url">
        <img :src="url">
    </div>
    <script src="../js/vue.js" type="text/javascript"></script>
    <script>
        const vm = new Vue({
            el: "#app",
            data: {
                url: "https://cn.vuejs.org/images/logo.png"
            }
        });
    </script>
</body>

</html>

运行结果:

posted @ 2020-03-08 14:11  牛牛的自留地  阅读(233)  评论(0编辑  收藏  举报