this.$refs取
时间: 2023-09-10 18:07:11 浏览: 103
Vue 解决通过this.$refs来获取DOM或者组件报错问题
当使用ref和v-for一起使用时,可以使用this.$refs来获取子组件身上的值。在使用v-for循环动态绑定ref时,this.$refs[name获取的是一个数组,因此需要使用this.$refs[name][0来获取具体的值。例如,在this.$nextTick回调函数中,可以通过this.$refs来执行相应的操作,比如调用子组件的方法execSqlData(data)。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [this.$refs获取不到子元素身上的方法is not a function等问题](https://blog.csdn.net/weixin_42289279/article/details/131735456)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [Vue 解决通过this.$refs来获取DOM或者组件报错问题](https://download.csdn.net/download/weixin_38649315/12924679)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [this.$refs获取不到dom的问题——恒生寻常问道实习记录](https://blog.csdn.net/versterben/article/details/126158592)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文