iView Select component used by has one method: clearSingleSelect () . The calling method is this.$refs.nameSelect.clearSingleSelect () , which has been tested for normal use. Now if you want to call in the render function, you can"t get this.$refs.nameSelect and report undefined
related codes
h("Select", {
ref: "nameSelect",
props: {
transfer: true,
clearable: true,
},
on: {
"on-change": (value) => {
if (value === "CLEAR") {
this.$refs.nameSelect.clearSingleSelect()
}
},
},
}, this.assembleOptions(h, this.options))
how to use $refs in Render function?
add:
< hr > this there is no problem pointing, log (this.$refs) you can see ref of other components written directly in template . The problem should be that when the render function renders the Select component, the this.$refs is not dynamically updated. So if you report undefined , is there a way to update this.$refs manually, or to get the instance rendered by the render function directly?
