The problem of refs in vue

clipboard.png

clipboard.png

because there is an el-dialog on the outside. You can"t get this.$refs.form,

it is possible to do this in the previous demo vue-admin-master

I wonder if it is the vue version update or the ElementUI version update that has this problem?

who has encountered this problem?

Apr.13,2022

m-oder is another component, go to the internal operation of the component


  1. m-order is a subcomponent or global component of orders .
  2. The content inside the
  3. component is filled into the component's slot, but the vue pursues where it is compiled, and the scope is there, so the scope of the slot content is in the orders component.

because you say this.$refs cannot get the form component instance, I judge that you execute this statement within the m-order or el-dialog component instance, which of course cannot be obtained. You need to call this.$refs.form in the orders instance to get it. If you want to get it in other components, you need to find the relationship between the current component and the orders component. For example, a parent-child relationship component can use the this.$parent.$refs attribute. If orders is the root component, you can use this.$root.$refs . Wait.

the above is for reference only. There is no actual test. In my experience, it should be so. If there is anything wrong, you are welcome to correct it.


another: you can add this.$refs ['editForm'] .clearValidate () to addOrUpdateUser, and add
clearValidate () {
this.$refs [' form'] .clearValidate ();
},
to remove the previous check information


this.$nextTick(() => {
    ...
})
.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eace85-47ecb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eace85-47ecb.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?