這個是要寫的元件的程式碼,跟不是元件的程式碼
<p id="parent">
<child :message="animal"></child>
</p>
<select name="sth" id="sth">
<option :value="value">{{text}}</option>
</select>
下邊的是JS
Vue.component('child',{
template:'<select :name="message+\'Select\'">\
<optgroup :label="message">\
<option :value="message">{{message}}</option>\
</optgroup>\
</select>',
props:['message']
});
new Vue({
el:"#parent",
data:{
animal:'phoenix'
}
});
new Vue({
el:"#sth",
data:{
value:'animal',
text:'animation'
}
});
最後渲染出來的是
<p id="parent">
<select name="phoenixSelect">
<optgroup label="phoenix">
<option>phoenix</option>
</optgroup>
</select>
</p>
<select name="sth" id="sth">
<option value="animal">animation</option>
</select>
下邊那個非元件的,value就能正常顯示成動態值animal,而上邊那個是元件的,name跟label都正常,就是value顯示不出來,請問是為什麼啊?