mirror of
https://github.com/youzan/vant.git
synced 2025-10-19 18:14:13 +00:00
[Improvement] NoticeBar: add ref check (#1037)
This commit is contained in:
@@ -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;
|
||||
|
Reference in New Issue
Block a user