<!DOCTYPE html>
<html lang="en">
 
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<style>
 
</style>
 
<body>
    <!-- 全局自定义指令 -->
    <div id="abc">
        <input type="text" v-focus>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        /*  Vue.directive('focus', {
                            inserted(el) {
                                //该自定义指令的调用者
                                el.focus();
                            }
                        }) */
        var vm = new Vue({
            el: '#abc',
            //模板ajax返回的数据
            data: {
                count: "geyao"
            },
            //局部自定义指令
            directives: {
                focus: {
                    inserted(el) {
                        el.focus();
                    }
                }
            },
            methods: {
 
            },
 
 
        })
    </script>
    <!-- 列表渲染 -->
    <!-- 1渲染数组 -->
    <!-- 2c处理无数据的时候 -->
</body>
 
</html>
 
