Vue.js 访问vue组件';子HTML节点中的属性
我正在使用for Vue,无法找到访问子HTML节点属性的父组件属性的方法 然而,我认为这与图书馆无关,只是我缺乏Vue方面的经验。我想我的问题与更简单的代码相同:Vue.js 访问vue组件';子HTML节点中的属性,vue.js,vuejs2,Vue.js,Vuejs2,我正在使用for Vue,无法找到访问子HTML节点属性的父组件属性的方法 然而,我认为这与图书馆无关,只是我缺乏Vue方面的经验。我想我的问题与更简单的代码相同: the-parent-component some-other-component h1(v-show="//how to show/hide based on my-component.status" 下面是一个真实的例子: 折叠包装时隐藏标题中的删除按钮(蓝色圆圈) 当包装器打开时显示它 库组件v
the-parent-component
some-other-component
h1(v-show="//how to show/hide based on my-component.status"
下面是一个真实的例子:
- 折叠包装时隐藏标题中的删除按钮(蓝色圆圈)
- 当包装器打开时显示它
v-collapse-wrapper
公开一个布尔属性status
,展开时为true
,折叠时为false
以下是我必须描述手风琴的代码(帕格语):
我尝试的是:
- 使用
,但似乎无法正常工作(非反应性)$refs
v-collapse-wrapper
内容,并让该组件公开其自己的状态属性(然后可以在其模板中的任何位置访问)
然而,我觉得这可能不值得,可能有一个更简单的解决办法
v-collapse-group(:only-one-active="true")
v-collapse-wrapper.collapsed(v-for="(item, id, index) in form.items")
div.card
div.card-header
h5(v-collapse-toggle="")
small
span(class="fa fa-chevron-up fa-fw collapse-indicator")
.
{{ getCardTitle(item) }}
a(href="#"
class="btn btn-sm btn-danger float-right"
@click.prevent="removeItem(item)")
| Delete