使用 vue.directive() 自定义全局的指令 v-focus v-color v-font-weight

<input type="text" v-model="value" v-focus v-color="'red'" >	

1、 v-focus

参数1:
	指令的名称,注意,在定义的时候指令的名称前面 不需要加v-前缀,
	但是:在调用的时候,必须在指令名称前面加上 v- 前缀来进行调用
	
参数2:
	是一个对象,这个对象身上,有一些指令相关的函数,
	这些函数可以在特定的阶段,执行相关的操作

在这里插入图片描述

2、 v-color

在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/weixin_43787528/article/details/88669470