来来去去
来来去去
  • 发布:2018-11-26 23:02
  • 更新:2020-06-05 17:33
  • 阅读:1696

ref标签为什么都是{}

分类:uni-app

我为view 、input添加的ref标签后,为什么获取都是{}
什么用没有,你们有遇到同样的情况吗?

<input class="priceInput" value="123" ref="price" type="digit" />

console.log(this.$refs.price)  
console.log(this.$refs.price.value)

请帮忙解答下,谢谢!

2018-11-26 23:02 负责人:无 分享
已邀请:
DCloud_UNI_GSQ

DCloud_UNI_GSQ

在app端和小程序内只能用在自定义组件上

2***@qq.com

2***@qq.com - 路人家


以下代码。this.$refs 返回对象是{},一直找不到loadingA对象,咋回事
版本:2.7.9 V3
之前V3以下是无问题。求急!!!!!!


<template> <view class="page"> <loading custom="false" shadeClick="false" shadeShow="true"

type="2" ref="loadingA"

<!-- <view class="test">自定义</view> -->
</loading>
</view>
</template>
<script>
import loading from '@/components/xuan-loading/xuan-loading.vue';
import {toast} from '@/common/js/common.js'

export default {
components: {
loading
},
onLoad(data) {
console.log("OAS0011")
this.IsHaveCache()
console.log(this.$refs);
console.log(this.$refs.loadingA);
this.$refs.loadingA.open();
this.loadImg(data.newId);

}  

</script>

该问题目前已经被锁定, 无法添加新回复