常用指令:

模板语法

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>模板语法</title>
    <script src="<https://cdn.jsdelivr.net/npm/[email protected]/dist/vue.js>"></script>

</head>
<body>
    <!-- 准备好一个容器 -->
    <div id="root">
        <h1>插值语法</h1>
        <h3>你好,{{name}}</h3>
        <hr>
        <h1>指令语法</h1>
        <a v-bind:href="blog.url.toUpperCase()">点击去{{blog.name}}的blog</a>
        <a :href="blog.url1">点击去{{blog.name}}的home</a>
    </div>

    <script type="text/javascript">
        Vue.config.productionTip = false; // 禁用提示
        new Vue({
            el: "#root",
            data:{
                name:'荣崽',
                blog:{
                    name:'xmelon',
                    url: '<https://xmelon.cafe>',
                    url1:'<https://home.xmelon.cafe>'
                }
            }
        })
    </script>
</body>
</html>
  1. 插值语法
  1. 指令语法