vux checklist 仿写总结

基于vux0.1.3

1 <label>

1.1 <label>+<input>

点击lable标签时,浏览器会自动聚焦到和lable相关的表单控件上去。

1.2 for属性

"for" 属性可把 label 绑定到另外一个元素。"for" 属性的值为相关元素的 id值。

2 filter

对传入的值进行过滤

filters: {
getValue,
getKey
}
 
export const getValue = function (item) {
return typeof item === 'object' ? item.value : item
}

export const getKey = function (item) {
return typeof item === 'object' ? item.key : item
}

3 watch

监听值的变化
watch: {
value (newVal, oldval) {
this.$emit('on-change', JSON.parse(JSON.stringify(newVal)))
}
}

4.checkbox

样式 :checked
用来做被选中后的效果

5.[Vue warn]:

Attributes "class", ":transition" are ignored on component <router-view> because the component is a fragment instance: http://vuejs.org/guide/components.html#Fragment-Instance

template下只能有一个根节点,否则报上面的警告。

原文地址:https://www.cnblogs.com/jun3101s/p/5919091.html