摘要: [Toc] 如何注册指令 如何注册一个全局自定义指令 //注册一个全局自定义指令 Vue.directive("focus",{ //当被绑定的元素插入到DOM中时: inserted:function(el){ //聚焦元素 el.focus() } }) directives:{ focus:{ 阅读全文
posted @ 2020-03-15 18:47 Syinho 阅读(184) 评论(0) 推荐(0)
摘要: ##为了防止模板复用 在vue中,为了提高渲染效率会尽可能复用模板。 例如: <div id="app"> <template> <div> <label for="" v-if="type 'name'"> <span>name:</span><input type="text" name="" 阅读全文
posted @ 2020-03-15 17:26 Syinho 阅读(826) 评论(0) 推荐(0)