12-基础-术语解释-指令

<!-- 
1. 容器
2. 引入
3. new Vue
4. 选项
 -->
<!DOCTYPE html>
<html>

<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='app'>
        <!-- 指令: 
        代码位置: 开始标签位置
        特点: v- 开头
        作用: 增强/扩展了标签的功能
        -->
        <!-- 例子: 给p绑定事件 -->
        <!-- v-on:事件名="methods中的方法名()" -->
        <p v-on:click="fn()">内容</p>
    </div>
    <script src='./vue.js'></script>
    <script>
        new Vue({
            el: '#app',
            data: {
            },
            methods: {
                fn() {
                    console.log("fn-----");
                }
            }
        });
    </script>
</body>

</html>

posted @ 2019-05-28 20:19  193557749  阅读(159)  评论(0编辑  收藏  举报