提交 9da6a971 编写于 作者: H hdx

test(createSelectorQuery): 新增组件根多节点测试

上级 f385e359
<template>
<view class="selector-query-view">
<text>selector-query</text>
<text class="text red">{{text1}}</text>
</view>
<view class="selector-query-view">
<text>selector-query</text>
<text class="text green">{{text2}}</text>
</view>
<view v-if="text1.length>0">1</view>
<text>{{text3}}</text>
</template>
<script>
export default {
data() {
return {
text1: "",
text2: "",
text3: "test-text-node",
viewCount: 0,
selectCount: 0,
selectAllCount: 0,
show: false
}
},
mounted() {
uni.createSelectorQuery().in(this).select('.selector-query-view').boundingClientRect().exec((ret) => {
this.text1 = JSON.stringify(ret)
if (ret.length == 1) {
this.selectCount = ret.length
}
})
uni.createSelectorQuery().in(this).selectAll('.selector-query-view').boundingClientRect().exec((ret) => {
this.text2 = JSON.stringify(ret)
if (ret.length == 1) {
this.selectAllCount = (ret[0] as NodeInfo[]).length
}
})
}
}
</script>
<style>
.green {
border: 3px solid green;
}
.red {
border: 3px solid red;
}
.view {
border: 3px dashed lime;
padding: 10px;
}
.text {
margin-top: 20px;
padding: 5px;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册