export default{
data(){
return{
}
},
render(h){
let that=this;//為了防止this的指向發生改變
console.log("render中的this", this);//Proxy {}對象
return h('input',{
// wa你想咋個命名就怎樣
wa:{
value: that.value,//獲取值
},
// 事件on,用來監聽input事件
on:{
'input':function(event){
that.$emit('input',event.target.value)
}
}
}
);
}
}
在使用的頁面中
import aa from "./myrender"
<aa v-model="name"></aa>
{{name}}
data(){
return{
name:"",
}
}
components:{
aa
}