mirror of
https://github.com/youzan/vant.git
synced 2025-10-20 10:44:59 +00:00
[Improvement] NoticeBar: add ref check (#1037)
This commit is contained in:
@@ -90,8 +90,13 @@ export default create({
|
|||||||
text: {
|
text: {
|
||||||
handler() {
|
handler() {
|
||||||
this.$nextTick(() => {
|
this.$nextTick(() => {
|
||||||
const offsetWidth = this.$refs.content.getBoundingClientRect().width;
|
const { wrap, content } = this.$refs;
|
||||||
const wrapWidth = this.$refs.wrap.getBoundingClientRect().width;
|
if (!wrap || !content) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wrapWidth = wrap.getBoundingClientRect().width;
|
||||||
|
const offsetWidth = content.getBoundingClientRect().width;
|
||||||
if (this.scrollable && offsetWidth > wrapWidth) {
|
if (this.scrollable && offsetWidth > wrapWidth) {
|
||||||
this.wrapWidth = wrapWidth;
|
this.wrapWidth = wrapWidth;
|
||||||
this.offsetWidth = offsetWidth;
|
this.offsetWidth = offsetWidth;
|
||||||
|
Reference in New Issue
Block a user