我有帶插槽的簡單模態視窗 plan.vue
...
<div class="plan__content">
<slot></slot>
</div>
...
還有使用它的example.vue
<button
@click="showPlan"
>
Show plan
</button>
<plan
v-if="isPlanVisible"
@closePlan="closePlan"
>
</plan>
我也有樹枝檔案 plan.html.twig
{% block field %}
<table id="plan_table">
<caption>
<h2> {{smth.name}} </h2>
</caption>
...
</table>
{% endblock %}
我可以在這里添加我的樹枝<plan> </plan>嗎?我試圖找到一個解決方案,但只找到了如何將 vue 添加到 twig 而不是反之亦然
uj5u.com熱心網友回復:
您不能在 Vue 組件中嵌入 twig 檔案并渲染它。您有兩種選擇:
- 您在“Vue 代碼”中實作了樹枝模板,并且根本不使用樹枝模板。
- 例如,您通過來自后端端點的 HTTP 請求加載呈現的樹枝模板,并在 Vue 組件 vie v-html 屬性中呈現回應。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/356365.html
上一篇:更新部分頁面
下一篇:每次遷移都會改變uuid列的學說
