为什么vue组件的属性,有的需要加冒号“:”,有的不用?
加冒号的,说明后面的是一个变量或者表达式;没加冒号的后面就是对应的字符串字面量。
如:
<my-progress :stroke-width="18" :percentage="30" mycolor="orange" status='exception' :text-inside="true" />
status和mycolor均为字符串的字面量 而其他的属性不是number就是bool
加冒号的,说明后面的是一个变量或者表达式;没加冒号的后面就是对应的字符串字面量。
如:
<my-progress :stroke-width="18" :percentage="30" mycolor="orange" status='exception' :text-inside="true" />
status和mycolor均为字符串的字面量 而其他的属性不是number就是bool