Ace*_*dez 2 javascript frameworks vue.js vuetify.js
我可以请求你的帮助吗,我目前正在使用 vuetifyjs 使列显示/隐藏,我偶然发现了这些参考文献:
https://codepen.io/anon/pen/jeWRvN
computedHeaders () {
if(this.hideCalories){
return this.headers.filter(header => header.text !== "Calories")
}
return this.headers;
}
Run Code Online (Sandbox Code Playgroud)
},
我的问题是它只能隐藏 1 个标题/列。你能帮我让它隐藏多个标题吗?我想实现这些输出:
非常感谢。
属性headers
可以计算
computed: {
headers() {
let headers = [
{
text: 'Dessert (100g serving)',
align: 'left',
sortable: false,
value: 'name'
}
]
if (!this.hideCalories) {
headers.push({ text: 'Calories', value: 'calories' })
}
if (!this.hideFat) {
headers.push({ text: 'Fat (g)', value: 'fat' })
}
// ...
headers.push({ text: 'Carbs (g)', value: 'carbs' })
headers.push({ text: 'Protein (g)', value: 'protein' })
headers.push({ text: 'Actions', value: 'name', sortable: false })
return headers
}
}
Run Code Online (Sandbox Code Playgroud)
然后headers
像以前一样传到桌子上。
归档时间: |
|
查看次数: |
4755 次 |
最近记录: |