1
在我的应用程序中,我有很多按钮。当我按下它,我想加载模板(即替换该按钮):VueJS - 点击交换组件
模板:
Vue.component('component-1', {...});
Vue.component('component-2', {...});
按钮:
<div id="toReplace">
<button>Button1</button>
<button>Button2</button>
</div>
在这种情况下,当我按下Button1
内容的div toReplace
应该是component-1
。 当然,每个组件应该有一个“关闭”按钮,在按下时再次显示按钮(简而言之,div toReplace
)。