当前位置:网站首页>$refs:组件中获取元素对象或者子组件实例:
$refs:组件中获取元素对象或者子组件实例:
2022-07-07 03:12:00 【要成为光的女人】
1.在某些情况下,我们在组件中想要直接获取到元素对象或者子组件实例:
- 在Vue开发中我们是不推荐进行DOM操作的;
- 在这个时候,我们可以给元素或者组件绑定一个ref的attribute属性;
组件实例有一个$refs属性:
他有一个对象Object,持有注册过 ref attribute 的所有DOM元素和组件实例;

边栏推荐
- Installing redis and windows extension method under win system
- Sword finger offer high quality code
- 【mysqld】Can't create/write to file
- Kotlin之 Databinding 异常
- Test of transform parameters of impdp
- How to share the same storage among multiple kubernetes clusters
- Lvs+kept (DR mode) learning notes
- Anr principle and Practice
- LC 面试题 02.07. 链表相交 & LC142. 环形链表II
- . Net 5 fluentftp connection FTP failure problem: this operation is only allowed using a successfully authenticated context
猜你喜欢
随机推荐
请教一个问题,flink oracle cdc,读取一个没有更新操作的表,隔十几秒就重复读取全量数据
Bus消息总线
impdp的transform参数的测试
Tool class: object to map hump to underline underline hump
一条慢SQL拖死整个系统
ANR 原理及实践
【mysqld】Can't create/write to file
大咖云集|NextArch基金会云开发Meetup来啦
[GNN] graphic gnn:a gender Introduction (including video)
Maze games based on JS
Abnova循环肿瘤DNA丨全血分离,基因组DNA萃取分析
品牌电商如何逆势增长?在这里预见未来!
途家、木鸟、美团……民宿暑期战事将起
品牌·咨询标准化
Lvs+kept (DR mode) learning notes
Installing redis and windows extension method under win system
How Oracle backs up indexes
Multidisciplinary integration
Redhat5 installing vmware tools under virtual machine
Brand · consultation standardization








