数据例子
```
let yuan = [{
goods_spec_id: 1,
goods_spec_gid: 1,
goods_spec_spectitle: "颜色",
goods_spec_sort: 1,
goods_spec_status: 1,
spec: [
{
goods_spec_info_id: 1,
goods_spec_info_gid: 1,
goods_spec_info_specid: 1,
goods_spec_info_title: "白色",
goods_spec_info_src: "",
goods_spec_info_sort: 0,
goods_spec_info_status: 1
},
{
goods_spec_info_id: 2,
goods_spec_info_gid: 1,
goods_spec_info_specid: 1,
goods_spec_info_title: "黑色",
goods_spec_info_src: "",
goods_spec_info_sort: 0,
goods_spec_info_status: 1
}
]
}]
```
多维数组都添加a为true字段
```
this.listspec.forEach(item=>{
if(item.a == true){
item.spec.forEach(item1=>{
if( this.checkList1.includes(item1.goods_spec_info_title)){
item1.a = true
}
})
}
})
```
递归函数
```
const filterMenu = menuList => {
return menuList.filter(item => {
return item.a == true;
}).map(item => {
item = Object.assign({}, item)
if(item.child && item.child.length > 0) {
item.child = filterMenu(item.child)
}
return item
})
}
```
vue版递归函数
```
//递归函数
filterMenu(menuList) {
return menuList.filter(item => {
return item.a == true;
}).map(item => {
item = Object.assign({}, item)
if(item.spec && item.spec.length > 0) {
item.spec = this.filterMenu(item.spec)
}
return item
})
},
```
vue调用
```
```
调用
```
let menuList = filterMenu(arr);
```
- webpack-dev-server不是内部或外部命令
- vue+ele添加笑脸表情
- from UglifyJs Unexpected token: punc (()
- vmodel-ref
- jscopy
- watch_or_computed
- checkbox-group
- array_filter
- array many filter
- js array unshift
- vue watch one
- sku
- edit-button
- el-select clearable placeholder
- 必填
- 如何设置一个索引从1开始
- Injection "elForm" not found
- $refs
- resetFields
- table 二级数据
- Table 合并
- switch 开关
- radio group 单选
- 二级菜单
- 访问页面出错后退到上一页
- 编辑器tinymce
- v-for从1开始索引
- 图片绑定路径
- 分栏间隔
- class绑定card底色
- 动态增减表单项
- watch deep
- form 获取值
- table索引方法
- table两个改一个另一个也跟着变解决方法
- table标题改整列
- vue echarts