【发布时间】:2020-04-15 21:54:57
【问题描述】:
当我使用下面的代码时,它会显示 SAN、DAVID 和 JAY 的三个按钮。如果我单击 SAN 或 David 或 Jay,它会生成 3 次模态。有没有一种方法,当我点击按钮 SAN 时,它只显示一次模态,并且在模态中包含 customerName (SAN)?
我的模板文件
<div id="app">
<div v-for="post in posts" v-bind:key="post.createdAt">
<div>
<b-col md="3">
<div v-for="item in post.items" v-bind:key="item.id">
<div v-on:click="item.id = !item.id" style="color: blue;">
<b-button v-b-modal.modal-xl variant="info">{{post.customerName}}</b-button>
/** the code display the modal from BOOTSTRAP VUE **/
<b-modal id="modal-xl" centered size="xl" title="TEAM NAME 1">
<p> Booker Name = <u style="font-weight:bold;">{{post.customerName}}</u> </p>
<b-container class="bv-example-row">
<b-row style="font-weight:bold;">
<b-col><p>Child Name</p></b-col>
<b-col><p>Text Number</p></b-col>
<b-col><p>No Show</p></b-col>
</b-row>
<b-row>
<b-col><p>David</p></b-col>
<b-col><p>P</p></b-col>
<b-col><p>817 360 2705</p></b-col>
<b-col><input type="checkbox" v-model="subchildNoShow"/></b-col>
</b-row>
</b-container>
</b-modal>
/** END OF MODAL **/
</div>
</div>
</b-col>
</div>
</div>
</div>
脚本函数
export default {
name: 'App',
components: {
},
data(){
return{
searchQuery: '',
posts: [],
subchildNoShow: []
}
}
}
JSON 文件值
data{
Object[0]{
customerName:'San',
createdAt: '2020-04-15',
items:{
id:'1',
arrivalTime:'06:00 PM'
}
}
Object[1]{
customerName:'David',
createdAt: '2020-04-15',
items:{
id:'2',
arrivalTime:'07:00 PM'
}
}
Object[2]{
customerName:'Jay',
createdAt: '2020-04-15',
items:{
id:'3',
arrivalTime:'07:00 PM'
}
}
}
【问题讨论】:
标签: javascript twitter-bootstrap vue.js vuejs2 bootstrap-vue