找回密码
 立即注册
搜索

不支持overflow hidden和获取元素宽高。

2
回复
783
查看
[复制链接]

1

主题

1

帖子

0

积分

 楼主| 2018-4-3 10:40:14 显示全部楼层 |阅读模式
如题。
回复

使用道具 举报

8

主题

226

帖子

700

积分

2018-4-9 20:05:19 显示全部楼层
不支持
回复

使用道具 举报

1

主题

7

帖子

40

积分

2022-7-4 15:01:38 显示全部楼层

使用getBoundingClientRect 方式: this.$element('box1').getBoundingClientRect({

                success: function (data) {

                    const { top, bottom, left, right, width, height } = data;

                    prompt.showToast({

                        message: `getBoundingClientRect结果: width:${width}, height:${height},

                         top:${top}, bottom:${bottom}, left:${left}, right:${right}`

                    })

                },

                fail: (errorData, errorCode) => {

                    prompt.showToast({

                        message: `错误原因:${JSON.stringify(errorData)}, 错误代码:${errorCode}`

                    })

                },

                complete: function () {

                    console.info('complete')

                }

            })

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册