当前位置: 首页>>代码示例 >>用法及示例精选 >>正文


Vue.js directives用法及代码示例


注册指令以供组件实例使用的对象。

类型

interface ComponentOptions {
  directives?: { [key: string]: Directive }
}

示例

export default {
  directives: {
    // enables v-focus in template
    focus: {
      mounted(el) {
        el.focus()
      }
    }
  }
}
<input v-focus>

可用于组件实例的指令散列。

相关用法


注:本文由纯净天空筛选整理自vuejs.org大神的英文原创作品 directives。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。