Vue之自定义指令
来源:互联网 发布:gta5ol捏脸美女数据 编辑:程序博客网 时间:2024/06/05 09:37
1.使用Vue.directive('指令名‘,方法);
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title></title> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="apple-mobile-web-app-status-bar-style" content="black"> <style> </style> <script src="vue.js"></script> <script> Vue.directive('red',function(){ this.el.style.background='red'; }); window.onload=function(){ var vm=new Vue({ el:'#box', data:{ msg:'welcome' } }); }; </script></head><body> <div id="box"> <span v-red> asdfasd </span> </div></body></html>
效果:
阅读全文
0 0
- vue之自定义指令
- Vue之自定义指令
- Vue之自定义指令
- vue.js之自定义指令
- Vue.js指令篇之自定义指令
- Vue之自定义指令进行表单验证。
- 09、vue.js 之自定义指令
- vue自定义指令-vue-reclick
- vue 自定义指令
- Vue自定义指令-拖拽
- Vue.js--自定义指令
- Vue自定义指令
- vue自定义指令
- vue自定义指令
- Vue.js--自定义指令
- vue-自定义指令-拖拽
- 14-Vue自定义指令
- Vue.directive 自定义指令
- Dual DSI on msm8937
- git 合并分支出现 Please enter a commit message to explain why this merge is necessary.
- java8 笔记
- springMVC--配置数据源
- 条款12:赋值对象时勿忘记其每一个成分
- Vue之自定义指令
- Mysql存储引擎(三)------常用存储引擎之间的对比
- H2数据库使用
- nSum系列题目总结
- java 使用jedis操作redis
- CS231n----assignment1 -notes for KNN
- 自调用匿名函数
- 一些java小案例
- ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务