加冒号,说明属性后是一个变量或表达式;
没加冒号,后面就是对应的字符串字面量;
例:
<input :disable="true">打开</input>
输出:true 或 false 值是变量/Boolean类型
例:
<input disable="true">打开</input>
输出:true 值是String类型
vue组件属性使用和不使用冒号的区别?
最新推荐文章于 2024-02-28 14:33:58 发布
加冒号,说明属性后是一个变量或表达式;
没加冒号,后面就是对应的字符串字面量;
例:
<input :disable="true">打开</input>
输出:true 或 false 值是变量/Boolean类型
例:
<input disable="true">打开</input>
输出:true 值是String类型