在Vue 1.0.28中,我可以这样做:
Vue.component('singletext', {
template: `<input type=text value="{{item.value}}" />`,
props: {
item: Object
}
});
并在查看页面源时获取此信息:
<input type="text" value="a value">
但是在Vue 2.0中,我必须使用v-bind,它在屏幕上正确显示了值,但是页面源缺少这样的属性:
Vue.component('singletext', {
template: `<input type=text :value="item.value" />`,
props: {
item: Object
}
});
页面来源:
<input type="text">
无论如何都要确保正确生成页面源? (没有SSR)