【发布时间】:2020-10-19 12:39:52
【问题描述】:
我尝试根据组状态(打开/关闭)更改附加图标。我尝试设置,但它不起作用:
v-list-group(
color="success"
@click:append="this.marker = !this.marker"
:append-icon="marker ? 'add' : 'remove'")
抱歉,代码不完整: (看起来您的帖子主要是代码;请添加更多详细信息) 哈巴狗
v-list(expand, dense, nav)
//1 list lvl
template(v-for="item in test")
v-list-item(
v-if="!item.categories",
)
v-list-item-title {{ item.id }}. {{ item.block }}
v-list-group(
v-else,
@click="marker = !marker",
:append-icon="marker ? 'add' : 'remove'"
)
template(#activator)
v-list-item-content
v-list-item-title {{ item.id }}. {{ item.block }}
//2 list lvl
template(v-for="subItem in item.categories")
v-list-item(
v-if="!subItem.elements",
)
v-list-item-title {{ subItem.id }}. {{ subItem.name }}
v-list-group(
v-else,
:append-icon="marker ? 'add' : 'remove'",
@click="marker = !marker"
)
....
//3 list lvl ...
【问题讨论】:
-
this.marker = !this.marker - 不是这个,我猜
-
不要在模板中使用“this”。
-
你是对的。但是如果我使用 marker = !marker 值不会改变。我尝试使用方法,但它也不起作用。
标签: vue.js vuetify.js