我有一個名為“Vintage White”的變數,我試圖將它傳遞給像這樣的輸入元素的屬性。
<input name={{ attribute_value }}>
我期望元素像這樣呈現
<input name="Vintage White">
但是我得到了這個
<input name="Vintage" white>
如何將帶有空格的整個字串傳遞給輸入元素,以便獲得預期的結果?
uj5u.com熱心網友回復:
需要使用引號,否則值會在 的第一個空格之前結束attribute_value,所以:
<input name="{{ attribute_value }}">
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/388449.html
