props
数组允许Vue组件声明它接收的属性值。有没有办法确定原始属性表达式是什么?
例如,对于此Vue组件:
Vue.component( 'my-component', Vue.extend( {
template: '<output>The answer is {{value}} but what is the question?</output>',
props: [ 'value' ]
} ));
new Vue( {
el: '#app',
data() {
return {
theQuestion: '42'
}
}
} );
和这个HTML:
<div id="app">
<my-component v-model="theQuestion"></my-component>
</div>
Vue组件如何访问theQuestion
属性中包含的文本字符串v-model
?在这里小提琴:https://jsfiddle.net/oznz8a4z/