Easy way to set a slot with a string of a variable?

时光怂恿深爱的人放手 提交于 2019-12-02 08:16:08

You can create a variable and change it by clicking on the desired button:

<button id="show-modal" @click="(header = 'HELLO') && (showModal = true)">
  Show Modal1
</button>
<button id="show-modal" @click="(header = 'BYE!') && (showModal = true)">
  Show Modal2
</button>
...
<h3 slot="header">{{header}}</h3>

https://jsfiddle.net/6k9drL1t/1/

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!