mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
[Improvement] NoticeBar: add ref check (#1037)
This commit is contained in:
parent
a92fa7d4a8
commit
8424b51aff
@ -90,8 +90,13 @@ export default create({
|
||||
text: {
|
||||
handler() {
|
||||
this.$nextTick(() => {
|
||||
const offsetWidth = this.$refs.content.getBoundingClientRect().width;
|
||||
const wrapWidth = this.$refs.wrap.getBoundingClientRect().width;
|
||||
const { wrap, content } = this.$refs;
|
||||
if (!wrap || !content) {
|
||||
return;
|
||||
}
|
||||
|
||||
const wrapWidth = wrap.getBoundingClientRect().width;
|
||||
const offsetWidth = content.getBoundingClientRect().width;
|
||||
if (this.scrollable && offsetWidth > wrapWidth) {
|
||||
this.wrapWidth = wrapWidth;
|
||||
this.offsetWidth = offsetWidth;
|
||||
|
Loading…
x
Reference in New Issue
Block a user