12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <template>
- <view :id="compId" ref="uxToastItemRef">
- <text>hello</text>
- <slot></slot>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- compId: 'comp1-id',
- testNode1: false
- }
- },
- props: {
- id: {
- type: String,
- default: ''
- }
- },
- emits: ['ready'],
- mounted() {
- uni.createSelectorQuery().in(this).select('#comp1-id').boundingClientRect().exec((ret) => {
- console.log(ret)
- this.testNode1 = ret.length > 0
- // #ifdef WEB || MP
- this.testNode1 = this.testNode1 && ret[0] != null
- // #endif
- if(this.testNode1) {
- console.log('Comp1测试符合预期')
- } else {
- console.error('Comp1测试不符合预期')
- }
- this.$emit('ready', this.testNode1)
- })
- }
- }
- </script>
- <style>
- </style>
|