无法正确获取DOM元素

iview.js?7687:24282 Uncaught TypeError: Cannot read property 'offsetWidth' of undefined

    at VueComponent.updateNavScroll (iview.js?7687:24282)

    at VueComponent.handleResize (iview.js?7687:24298)

    at callListenerProxy (iview.js?7687:23611)

    at utils.forEach (iview.js?7687:23800)

    at onResizeCallback (iview.js?7687:23610)

    at listenerProxy (iview.js?7687:38526)

    at VueComponent.updateNavScroll (iview.js?7687:24282)

    at VueComponent.handleResize (iview.js?7687:24298)

    at addListener (iview.js?7687:23619)

    at onElementDetectable (iview.js?7687:23694)




在使用iview表单的时候出现了这个错误

 updateNavScroll: function updateNavScroll() {

            var navWidth = this.$refs.nav.offsetWidth;

            var containerWidth = this.$refs.navScroll.offsetWidth;

            var currentOffset = this.getCurrentScrollOffset();

            if (containerWidth < navWidth) {

                this.scrollable = true;

                if (navWidth - currentOffset < containerWidth) {

                    this.setOffset(navWidth - containerWidth);

                }

            } else {

                this.scrollable = false;

                if (currentOffset > 0) {

                    this.setOffset(0);

                }

            }

        },


xiaomizhou66
浏览 1603回答 1
1回答
打开App,查看更多内容
随时随地看视频慕课网APP