简体   繁体   English

按下按钮后,Vue.js 会动态呈现 bootstrap-vue 组件

[英]Vue.js render a bootstrap-vue component dynamically after a button is pressed

I have this as part of my template我有这个作为我的模板的一部分

 <button class="add" v-on:click="handleAdd(0)"><img id="0" src="../assets/plus.svg" /></button> <div class="objectives-list"> <div class="objective-holder" id="0"> <b-button vb-toggle.ld-0 class="objective"> <div class="short-description">I am a short description.</div> <b-collapse class="long-description" id="ld-0" @show="handleShow(0, 0, 0)" @hide="handleHide(0, 0, 0)">I am a long description.</b-collapse> </b-button> </div> </div>

I am trying to add a new "objective-holder" to the "objective-list" and I am having trouble figuring out how to create new b-button and b-collapse from BootstrapVue in a javascript function that is part of my .vue methods functions.我正在尝试向“目标列表”添加一个新的“目标持有者”,但我无法弄清楚如何在我的 .vue 的一部分的 JavaScript 函数中从 BootstrapVue 创建新的 b 按钮和 b 折叠方法函数。

You might be able to use a render function instead of a template, or some type of component utilizing a render function to programmatically create your button element.您可能能够使用渲染函数而不是模板,或者使用渲染函数的某种类型的组件以编程方式创建您的按钮元素。 https://v2.vuejs.org/v2/guide/render-function.html#ad https://v2.vuejs.org/v2/guide/render-function.html#ad

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM