帖子
帖子
用户
博客
课程
123下一页
返回列表 发新帖
显示全部楼层
13
帖子
0
勋章
57
Y币

[其他] apicloud3 如何获取元素高度

[复制链接]
发表于 2021-9-10 11:27:55
apicloud3 如何获取元素高度
网站怎么获取就可以怎么获取
13
帖子
0
勋章
57
Y币
这么简单还用发帖问吗
正常的获取方式都获取不到
0
帖子
0
勋章
222
Y币
jquery height()
0
帖子
0
勋章
222
Y币
你的代码贴出来看看
怎么可能获取不到代码有问题
13
帖子
0
勋章
57
Y币
<template name='local-service-list'>
    <view class="page">
                <a-header onClickLeft="headerLeftClickedHandler" right-icon>本地服务</a-header>
                <safe-area>
                        <view class="tab-wap" id="tabs">
                                <text v-for="(item, index) in tabs" :class={item.class} @click="tabClickHandler(index, item.id)">{{ item.title }}</text>
                        </view>
                </safe-area>
    </view>
</template>
<script>
        import AHeader from '../../components/a-header.stml'
        export default {
                name: 'local-service-list',
                apiready(){//like created
},
                data() {
                        return{
                                tabs: [
                                        {id: 'treatment', title: '医疗', class: 'tab__active'},
                                        {id: 'board', title: '寄养', class: 'tab'},
                                        {id: 'other', title: '其他', class: 'tab'}
                                ]
                        }
                },
                methods: {
                        tabClickHandler(index, id, changeFrame = true) {
                                if (changeFrame) {
                                        api.setFrameGroupIndex({
                                                name: 'mainGroup',
                                                scroll: true,
                                                index: index
                                        })
                                }
                                this.data.tabs.filter(value => {
                                        value.class = 'tab'
                                        return value.id === id
                                })[0].class = 'tab__active'
                        },
                        scrollHandler(ev) {
                                console.log(JSON.stringify(ev.detail))
                        },
                        headerLeftClickedHandler() {
                                api.closeWin()
                                api.setStatusBarStyle({
                                        style: 'dark',
                                        color: 'rgba(0,0,0,0)',
                                        animated: true
                                })
                        }
                }
        }
</script>
13
帖子
0
勋章
57
Y币
console.log(document.getElementById('tabs').clientHeight);
console.log(document.querySelector('#tabs').clientHeight);
这两个在apiready() 里面没剪出来
13
帖子
0
勋章
57
Y币
[2021-9-10 11:42:34][INFO]  at list.js : 0
[2021-9-10 11:42:34][INFO]  at list.js : 0
0
帖子
0
勋章
222
Y币
有没有试过 加个延时打印 延时个 1秒左右
123下一页
您需要登录后才可以回帖 登录

本版积分规则