用一串变量设置插槽的简单方法?
Easy way to set a slot with a string of a variable?
有很多 slot
示例,但没有我需要的简单明了...我需要类似
的东西
var x="Hello";
$slot = x;
这就是我需要的...
在一个具体的例子中:https://jsfiddle.net/2qdh3x3v/
我需要一个简单的方法来设置插槽header
到"HELLO"单击"ShowModal1",单击"ShowModal2"时变为"BYE!"。
您可以创建一个变量并通过单击所需的按钮来更改它:
<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>
有很多 slot
示例,但没有我需要的简单明了...我需要类似
var x="Hello";
$slot = x;
这就是我需要的...
在一个具体的例子中:https://jsfiddle.net/2qdh3x3v/
我需要一个简单的方法来设置插槽header
到"HELLO"单击"ShowModal1",单击"ShowModal2"时变为"BYE!"。
您可以创建一个变量并通过单击所需的按钮来更改它:
<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>