【发布时间】:2020-04-09 15:11:19
【问题描述】:
我已经动态创建了按钮和 div,我想在点击相关按钮时显示 div 并隐藏其余部分。我不知道计数,因为它们是动态创建的。在vue js中怎么做?
<div style="margin-left: -88px;margin-top: 20px;">
<button v-for="namelock in tour_location" style="background-color:#EFF5FA;border: 0;border-radius: 15px;font-size: 14px;margin-left: 60px;">{{namelock.name}}</button>
<div v-for="(location,index ) in tour_location">
<h1>My Dynamic data</h1></div>
【问题讨论】:
-
你能告诉我们你到目前为止做了什么吗?
-
我在我的问题中添加了代码,我之前尝试过 v-if 但为此我必须首先初始化我不想要的变量,因为这些数据是动态的
-
您能告诉我们您在
v-for中使用的数组示例吗?以及何时显示按钮的条件 -
我只是点击什么按钮,相关的 div 应该显示在标签菜单中
标签: vue.js vuejs2 vue-component vuex vuetify.js