diff --git a/components/uni-collapse-item/uni-collapse-item.vue b/components/uni-collapse-item/uni-collapse-item.vue index 4befd0875add3edd748cdf50b86b88c3f60a6055..6d5ff9550924e85ebfa144a26652f0776d1add8d 100644 --- a/components/uni-collapse-item/uni-collapse-item.vue +++ b/components/uni-collapse-item/uni-collapse-item.vue @@ -35,8 +35,8 @@ return { height: 0, is_open: this.open as boolean, - boxNode: null as UniElement | null, - contentNode: null as UniElement | null, + boxNode: null as Element | null, + contentNode: null as Element | null, }; }, watch: { @@ -51,8 +51,8 @@ $dispatch(this, 'UniCollapse', 'init', this) }, mounted() { - this.boxNode = this.$refs['boxRef'] as UniElement; - this.contentNode = this.$refs['contentRef'] as UniElement; + this.boxNode = this.$refs['boxRef'] as Element; + this.contentNode = this.$refs['contentRef'] as Element; // this.openCollapse(this.open) }, methods: { diff --git a/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue b/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue index f1e84cc80a2c165413308d8a9d93132ac95832a6..548e928a43373e360ffc8a34dffd26f260326cb9 100644 --- a/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue +++ b/pages/API/get-element-by-id/get-element-by-id-multiple-root-node.uvue @@ -23,7 +23,7 @@ } }, methods: { - getElementByNotExistId() : UniElement | null { + getElementByNotExistId() : Element | null { return uni.getElementById('not-exist-id') }, changePageHeadBackgroundColor() { diff --git a/pages/API/get-element-by-id/get-element-by-id.uvue b/pages/API/get-element-by-id/get-element-by-id.uvue index 201178acb191157fbacb6f88ad8cd3f8540d3f84..0a94e3fec73e846d2185dd24f59ed966d8781c73 100644 --- a/pages/API/get-element-by-id/get-element-by-id.uvue +++ b/pages/API/get-element-by-id/get-element-by-id.uvue @@ -30,7 +30,7 @@ } }, methods: { - getElementByNotExistId() : UniElement | null { + getElementByNotExistId() : Element | null { return uni.getElementById('not-exist-id') }, changePageHeadBackgroundColor() { diff --git a/pages/CSS/layout/z-index.uvue b/pages/CSS/layout/z-index.uvue index 5694184c947d3c5c930333fd67eaa78edf50c342..9564f69c8c2e8a8f41ac602cad1ac4790f161ea2 100644 --- a/pages/CSS/layout/z-index.uvue +++ b/pages/CSS/layout/z-index.uvue @@ -36,7 +36,7 @@ methods: { changeZIndex(zIndex : number) { this.zIndex = 20; - (this.$refs['view'] as UniElement).style.setProperty('z-index', zIndex); + (this.$refs['view'] as Element).style.setProperty('z-index', zIndex); } } } diff --git a/pages/CSS/transition/transition.uvue b/pages/CSS/transition/transition.uvue index efe80410d8fbaa6bc10c8c6c41d6f8855497c174..74c5d6b273427d06a8e3054182cf368b88da7083 100644 --- a/pages/CSS/transition/transition.uvue +++ b/pages/CSS/transition/transition.uvue @@ -52,24 +52,24 @@ data() { return { isTranstionWidthOrHeight: false, - widthOrHeight: null as UniElement | null, + widthOrHeight: null as Element | null, isTranstionChangeMargin: false, - styleMargin: null as UniElement | null, + styleMargin: null as Element | null, isTransitionStylePadding: false, - stylePadding: null as UniElement | null, + stylePadding: null as Element | null, isTransitionstyleBackground: false, - styleBackground: null as UniElement | null, + styleBackground: null as Element | null, isTransitionStyleTransform: false, - styleTransform: null as UniElement | null, + styleTransform: null as Element | null, isTransitionstyleBorder: false, - styleBorder: null as UniElement | null, + styleBorder: null as Element | null, isTransitionstylePosition: false, - stylePosition: null as UniElement | null, + stylePosition: null as Element | null, isSetTransition: false, isTransitionpropertystyleBackground: false, - propertyStyleBackground: null as UniElement | null, + propertyStyleBackground: null as Element | null, isTransitionStyleTransformWithOrigin: false, - styleTransformWithOrigin: null as UniElement | null, + styleTransformWithOrigin: null as Element | null, } }, onReady() { diff --git a/pages/component/general-attribute/general-attribute.uvue b/pages/component/general-attribute/general-attribute.uvue index 315a3aea44dd28fd07643fe764a1caf27bab729f..0ac0ff6f06e3dc8c025641606f51a943e1a6c22e 100644 --- a/pages/component/general-attribute/general-attribute.uvue +++ b/pages/component/general-attribute/general-attribute.uvue @@ -70,7 +70,7 @@ export default { }, methods: { validateGeneralAttributes() { - const generalTarget = this.$refs['general-target'] as UniElement + const generalTarget = this.$refs['general-target'] as Element const generalId = generalTarget.getAttribute('id') if (generalId != this.generalId) { this.validateGeneralAttrText = '基础属性 id 验证失败' @@ -103,7 +103,7 @@ export default { this.validateGeneralAttrText = '基础属性验证成功' }, changeHeight(){ - const generalTarget = this.$refs['general-target'] as UniElement + const generalTarget = this.$refs['general-target'] as Element this.changeHeightByRefText = '已通过 ref 修改高度' generalTarget.style.setProperty('height', '200px') } diff --git a/pages/component/general-event/touch-event.uvue b/pages/component/general-event/touch-event.uvue index 6bf15023eb31538a679a1289fbef904b1c0e5829..0b9bc6cacdf8c56acaee70d81ea9212d21db9f41 100644 --- a/pages/component/general-event/touch-event.uvue +++ b/pages/component/general-event/touch-event.uvue @@ -28,7 +28,7 @@ lastX: 0, lastY: 0, touchEvent: null as TouchEvent | null, - icon: null as UniElement | null + icon: null as Element | null } }, onReady() { diff --git a/pages/component/general-event/transition-event.uvue b/pages/component/general-event/transition-event.uvue index 3ce94e816073df7c8071bf84870685ebc2b80067..40f1e9a04d2ee16b26d20e5c00eb6e7e599f6da4 100644 --- a/pages/component/general-event/transition-event.uvue +++ b/pages/component/general-event/transition-event.uvue @@ -15,7 +15,7 @@ data() { return { times: 0, - element: null as UniElement | null, + element: null as Element | null, isStart: false, buttonValue: "开启图片旋转", onTransitionEndTriggr: false diff --git a/pages/component/input/input.uvue b/pages/component/input/input.uvue index 5311ced83e74ffceae3dcce5caceda20f677d0fc..71371945ad3ae1aac45000c8d3f54c85254344a2 100644 --- a/pages/component/input/input.uvue +++ b/pages/component/input/input.uvue @@ -255,11 +255,11 @@ this.onMaxLengthInputValue = event.detail.value }, setCursor: function (cursor : number) { - (this.$refs['input'] as UniElement).focus(); + (this.$refs['input'] as Element).focus(); this.cursor = cursor; }, setSelection: function (selectionStart : number, selectionEnd : number) { - (this.$refs['input2'] as UniElement).focus(); + (this.$refs['input2'] as Element).focus(); this.selectionStart = selectionStart; this.selectionEnd = selectionEnd; }, diff --git a/pages/component/list-view/list-view.uvue b/pages/component/list-view/list-view.uvue index e43c308e80284af6756e89339189d1ac5db51566..51bcb9fe508412c4d324b031b409731c4a895312 100644 --- a/pages/component/list-view/list-view.uvue +++ b/pages/component/list-view/list-view.uvue @@ -92,7 +92,7 @@ item_change_size_enum(index : number) { this.scrollIntoView = "item---"+index }, //自动化测试例专用 check_scroll_height(): Boolean { - var listElement = this.$refs["listview"] as UniElement + var listElement = this.$refs["listview"] as Element console.log("check_scroll_height--"+listElement.scrollHeight) if(listElement.scrollHeight > 2000) { return true @@ -101,7 +101,7 @@ }, //自动化测试例专用 check_scroll_width(): Boolean { - var listElement = this.$refs["listview"] as UniElement + var listElement = this.$refs["listview"] as Element console.log("check_scroll_width"+listElement.scrollWidth) if(listElement.scrollWidth > 2000) { return true diff --git a/pages/component/scroll-view/scroll-view-props.uvue b/pages/component/scroll-view/scroll-view-props.uvue index a5b52114c421104373adcfe134e73f31d961aa8a..08c204799a4777e1e17008eeb68ab0d99bed55a3 100644 --- a/pages/component/scroll-view/scroll-view-props.uvue +++ b/pages/component/scroll-view/scroll-view-props.uvue @@ -184,7 +184,7 @@ checkScrollHeight(): Boolean { var element = this.$refs["scrollViewY"] if(element != null) { - var scrollHeight = (element as UniElement).scrollHeight + var scrollHeight = (element as Element).scrollHeight console.log("checkScrollHeight"+scrollHeight) if(scrollHeight > 1900) { return true @@ -196,7 +196,7 @@ checkScrollWidth(): Boolean { var element = this.$refs["scrollViewX"] if(element != null) { - var scrollWidth = (element as UniElement).scrollWidth + var scrollWidth = (element as Element).scrollWidth console.log("checkScrollWidth---"+scrollWidth) if(scrollWidth > 1900) { return true diff --git a/pages/component/sticky-section/sticky-section.uvue b/pages/component/sticky-section/sticky-section.uvue index db52d027bb43e6b3c5942138a4a51ccb7cdd024b..45da8b32837746fb71467cc832bb1eaee1afe219 100644 --- a/pages/component/sticky-section/sticky-section.uvue +++ b/pages/component/sticky-section/sticky-section.uvue @@ -37,7 +37,7 @@ }, //用于自动化测试 listViewScrollByY(y : number) { - const listview = this.$refs["list-view"] as UniElement + const listview = this.$refs["list-view"] as Element listview.scrollBy(0, y) }, gotoStickyHeader(id : string) { diff --git a/pages/tabBar/API.uvue b/pages/tabBar/API.uvue index 4a32c1f0b9c991fa1ff0a826f286313657dd6087..8d438f1a9ee74254c6abae9e0c076f69fe7258d0 100644 --- a/pages/tabBar/API.uvue +++ b/pages/tabBar/API.uvue @@ -158,11 +158,11 @@ { name: 'element draw', url: 'element-draw', - api: ["UniElement.getDrawableContext"] + api: ["Element.getDrawableContext"] },{ name: 'element截图', url: 'element-takesnapshot', - api: ["UniElement.takeSnapshot"] + api: ["Element.takeSnapshot"] }, { name: 'node节点', @@ -522,10 +522,10 @@ }) }, showPop: function () { - (this.$refs["pop"] as UniElement).style.setProperty("display", "flex") + (this.$refs["pop"] as Element).style.setProperty("display", "flex") }, hidePop: function () { - (this.$refs["pop"] as UniElement).style.setProperty("display", "none") + (this.$refs["pop"] as Element).style.setProperty("display", "none") }, stopClickPop: function (e : MouseEvent) { e.stopPropagation() //点击到pop的非灰色区域,拦截点击事件 diff --git a/pages/template/calendar/calendar.uvue b/pages/template/calendar/calendar.uvue index 6d8a37ccaa1cc0f4fd6ccba310127046ac03649f..1de734f0a6332dcb8c85aa2c50aab10e23e1d0f9 100644 --- a/pages/template/calendar/calendar.uvue +++ b/pages/template/calendar/calendar.uvue @@ -70,7 +70,7 @@ export default { // 触发整个日历的点击事件,需要计算点击位置 select (event: TouchEvent) { - const refs = this.$refs['draw-weeks'] as UniElement + const refs = this.$refs['draw-weeks'] as Element const rect = refs.getBoundingClientRect(); const dom_x = rect.left; // 元素左上角相对于视口的 X 坐标 const dom_y = rect.top; // 元素左上角相对于视口的 Y 坐标 @@ -144,7 +144,7 @@ export default { // 绘制日历顶部信息 drawHeader () { - const refs = this.$refs['draw-header'] as UniElement + const refs = this.$refs['draw-header'] as Element let ctx = refs.getDrawableContext() if (ctx == null) return const date_header_map = ['一', '二', '三', '四', '五', '六', '日'] @@ -172,7 +172,7 @@ export default { // 绘制日历主体 drawWeek (weeks: Array>, time: string) { const start_time = Date.now() - const refs = this.$refs['draw-weeks'] as UniElement + const refs = this.$refs['draw-weeks'] as Element let ctx = refs.getDrawableContext() if (ctx == null) return const dom = refs.getBoundingClientRect() diff --git a/pages/template/custom-tab-bar/custom-tab-bar-tab1.uvue b/pages/template/custom-tab-bar/custom-tab-bar-tab1.uvue index 42d837f2c4409bd89fbc26c679b01b2208fabc48..c0b2f1528e3b10055108a75fb03d5e0dfc384cdc 100644 --- a/pages/template/custom-tab-bar/custom-tab-bar-tab1.uvue +++ b/pages/template/custom-tab-bar/custom-tab-bar-tab1.uvue @@ -35,7 +35,7 @@ uni.$emit('tabchange', e.detail.scrollTop) }, scrollTop(top : number) { - (this.$refs["listView"] as UniElement).scrollTop = top + (this.$refs["listView"] as Element).scrollTop = top } } } diff --git a/pages/template/custom-tab-bar/custom-tab-bar.uvue b/pages/template/custom-tab-bar/custom-tab-bar.uvue index 7f55f0e4d7e374fc93501095b9e486c79bd67952..c33da26ec5f2dd5b7f7d644146dbe51b3e36a699 100644 --- a/pages/template/custom-tab-bar/custom-tab-bar.uvue +++ b/pages/template/custom-tab-bar/custom-tab-bar.uvue @@ -73,7 +73,7 @@ }, onReady() { this.setSelectedIndex(0) - this.$tabViewHeight = (this.$refs["tabview"] as UniElement).getBoundingClientRect().height + this.$tabViewHeight = (this.$refs["tabview"] as Element).getBoundingClientRect().height }, onUnload() { uni.$off('tabchange', this.onTabPageEvent) diff --git a/pages/template/drop-card/card/card.uvue b/pages/template/drop-card/card/card.uvue index 84b3699aa130ebc33fadfe8041b1b968d1802755..551733c49d4726e4ec6353de2de3f7504e1c4dbd 100644 --- a/pages/template/drop-card/card/card.uvue +++ b/pages/template/drop-card/card/card.uvue @@ -21,7 +21,7 @@ export default { data() { return { - $elementMap: new Map(), + $elementMap: new Map(), x: 0 as number, y: 0 as number, // 飘走的卡片计数 @@ -78,12 +78,12 @@ this.setElementStyle('card', 'margin-top', screenHeight * 0.15 - 30 * _index + 'px'); this.setElementStyle('card', 'transform', 'scale(' + (0.9 + 0.05 * _index) + ')') }, - // 工具方法,用于快速设置 UniElement 的 style + // 工具方法,用于快速设置 Element 的 style setElementStyle(refName : string, propertyName : string, propertyStyle : any) : void { - const elementMap = this.$data['$elementMap'] as Map - let element : UniElement | null = elementMap.get(refName) + const elementMap = this.$data['$elementMap'] as Map + let element : Element | null = elementMap.get(refName) if (element == null) { - element = this.$refs[refName] as UniElement; + element = this.$refs[refName] as Element; elementMap.set(refName, element) } else { // console.log('直接拿'); diff --git a/pages/template/half-screen/half-screen.uvue b/pages/template/half-screen/half-screen.uvue index 1fd0bcf8e2043a2317935d7f122bf98f14290522..8c39cdbf74e928fb49f0a4974c6cd524c03fb781 100644 --- a/pages/template/half-screen/half-screen.uvue +++ b/pages/template/half-screen/half-screen.uvue @@ -28,8 +28,8 @@ lastY: 0, //上次 lastY2: 0, // bAnimation: false, //是否动画 - halfNode: null as UniElement | null, - scrollNode: null as UniElement | null + halfNode: null as Element | null, + scrollNode: null as Element | null } }, methods: { diff --git a/pages/template/long-list/long-list.uvue b/pages/template/long-list/long-list.uvue index 22a5c01b32299682e624fa5115da54c9af0fb3db..7445142ccf937c9d8d15b55c288632a41f68f363 100644 --- a/pages/template/long-list/long-list.uvue +++ b/pages/template/long-list/long-list.uvue @@ -79,21 +79,21 @@ } as SwiperViewItem ] as SwiperViewItem[], swiperIndex: -1, - $pageScrollView: null as null | UniElement, + $pageScrollView: null as null | Element, $headerHeight: 0, $animationFinishIndex: 0, - $tabScrollView: null as null | UniElement, - $indicatorNode: null as null | UniElement, + $tabScrollView: null as null | Element, + $indicatorNode: null as null | Element, $swiperWidth: 0, $swiperTabsRect: [] as SwiperTabsItem[] } }, onReady() { - this.$pageScrollView = this.$refs['pageScrollView'] as UniElement; - this.$headerHeight = (this.$refs['header'] as UniElement).offsetHeight - this.$swiperWidth = (this.$refs['swiper'] as UniElement).getBoundingClientRect().width - this.$tabScrollView = this.$refs['tabScroll'] as UniElement - this.$indicatorNode = this.$refs['indicator'] as UniElement + this.$pageScrollView = this.$refs['pageScrollView'] as Element; + this.$headerHeight = (this.$refs['header'] as Element).offsetHeight + this.$swiperWidth = (this.$refs['swiper'] as Element).getBoundingClientRect().width + this.$tabScrollView = this.$refs['tabScroll'] as Element + this.$indicatorNode = this.$refs['indicator'] as Element this.cacheTabItemsSize() this.setSwiperIndex(0, true) }, @@ -173,7 +173,7 @@ }, cacheTabItemsSize() { this.$swiperTabsRect.length = 0 - const tabs = this.$refs["swipertab"] as UniElement[] + const tabs = this.$refs["swipertab"] as Element[] tabs.forEach((node) => { this.$swiperTabsRect.push({ x: node.offsetLeft, diff --git a/pages/template/long-list2/long-list2.uvue b/pages/template/long-list2/long-list2.uvue index 97248f7cec78216417a910636d98a99431ebc1bb..ddc87889016de4a91714d8d2d41cb186c8a2bf78 100644 --- a/pages/template/long-list2/long-list2.uvue +++ b/pages/template/long-list2/long-list2.uvue @@ -89,22 +89,22 @@ } as SwiperViewItem ] as SwiperViewItem[], swiperIndex: -1, - $pageScrollView: null as null | UniElement, + $pageScrollView: null as null | Element, $headerHeight: 0, $animationFinishIndex: 0, - $tabScrollView: null as null | UniElement, - $indicatorNode: null as null | UniElement, + $tabScrollView: null as null | Element, + $indicatorNode: null as null | Element, $swiperWidth: 0, $swiperTabsRect: [] as SwiperTabsItem[], nestedScrollChildId: "" } }, onReady() { - this.$pageScrollView = this.$refs['pageScrollView'] as UniElement; - this.$headerHeight = (this.$refs['header'] as UniElement).offsetHeight - this.$swiperWidth = (this.$refs['swiper'] as UniElement).getBoundingClientRect().width - this.$tabScrollView = this.$refs['tabScroll'] as UniElement - this.$indicatorNode = this.$refs['indicator'] as UniElement + this.$pageScrollView = this.$refs['pageScrollView'] as Element; + this.$headerHeight = (this.$refs['header'] as Element).offsetHeight + this.$swiperWidth = (this.$refs['swiper'] as Element).getBoundingClientRect().width + this.$tabScrollView = this.$refs['tabScroll'] as Element + this.$indicatorNode = this.$refs['indicator'] as Element this.cacheTabItemsSize() this.setSwiperIndex(0, true) }, @@ -176,7 +176,7 @@ }, cacheTabItemsSize() { this.$swiperTabsRect.length = 0 - const tabs = this.$refs["swipertab"] as UniElement[] + const tabs = this.$refs["swipertab"] as Element[] tabs.forEach((node) => { this.$swiperTabsRect.push({ x: node.offsetLeft, diff --git a/pages/template/pull-zoom-image/pull-zoom-image.uvue b/pages/template/pull-zoom-image/pull-zoom-image.uvue index bbecfe986671d7986f78f4d52c119a881d512215..ee1f4de52082f4daea6c146a69c112c5c7503f86 100644 --- a/pages/template/pull-zoom-image/pull-zoom-image.uvue +++ b/pages/template/pull-zoom-image/pull-zoom-image.uvue @@ -36,7 +36,7 @@ export default { data() { return { - $elementMap: new Map() + $elementMap: new Map() } }, methods: { @@ -60,12 +60,12 @@ this.setElementStyle("head-img-1", 'transform', `scale(${pullingDistance / 200 + 1})`) this.setElementStyle("head-img-2", 'transform', `scale(${pullingDistance / 200 + 1})`) }, - // 工具方法,用于快速设置 UniElement 的 style + // 工具方法,用于快速设置 Element 的 style setElementStyle(refName : string, propertyName : string, propertyStyle : any) : void { - let element : UniElement | null = (this.$data['$elementMap'] as Map).get(refName) + let element : Element | null = (this.$data['$elementMap'] as Map).get(refName) if (element == null) { - element = this.$refs[refName] as UniElement; - (this.$data['$elementMap'] as Map).set(refName, element) + element = this.$refs[refName] as Element; + (this.$data['$elementMap'] as Map).set(refName, element) } element.style.setProperty(propertyName, propertyStyle); }, diff --git a/pages/template/scroll-fold-nav/scroll-fold-nav.uvue b/pages/template/scroll-fold-nav/scroll-fold-nav.uvue index aaa52df86af0e49dc8102d3ba441673d67558250..9bbb967463ce3606bc307b4732cd2ba9ffca2fc0 100644 --- a/pages/template/scroll-fold-nav/scroll-fold-nav.uvue +++ b/pages/template/scroll-fold-nav/scroll-fold-nav.uvue @@ -41,17 +41,17 @@ statusBarHeight: 35, scrollTop: 0, searchWidth: 700, - searchNode: null as UniElement | null, - boxNode: null as UniElement | null, - navNode: null as UniElement | null + searchNode: null as Element | null, + boxNode: null as Element | null, + navNode: null as Element | null } }, onLoad() { }, onReady() { this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight ?? 35; - this.searchNode = this.$refs['search'] as UniElement; - this.boxNode = this.$refs['top-box'] as UniElement; - this.navNode = this.$refs['scroll-fold-nav'] as UniElement; + this.searchNode = this.$refs['search'] as Element; + this.boxNode = this.$refs['top-box'] as Element; + this.navNode = this.$refs['scroll-fold-nav'] as Element; }, methods: { onScroll(e : ScrollEvent) { diff --git a/pages/template/scroll-sticky/scroll-sticky.uvue b/pages/template/scroll-sticky/scroll-sticky.uvue index b25ca29a607acd2c1daf774c9ca6cef499a6e5f4..782ae1da7279f62642dc17b0b201b855edfa0d80 100644 --- a/pages/template/scroll-sticky/scroll-sticky.uvue +++ b/pages/template/scroll-sticky/scroll-sticky.uvue @@ -34,7 +34,7 @@ stickyTop: 0, stickyTran: 0, scrollTop: 0, - stickyNode: null as UniElement | null + stickyNode: null as Element | null } }, methods: { @@ -67,11 +67,11 @@ onLoad() { }, onReady() { - this.stickyNode = this.$refs['sticky'] as UniElement; + this.stickyNode = this.$refs['sticky'] as Element; // let rect = this.stickyNode?.getBoundingClientRect(); // this.stickyTop = rect?.top; //this.stickyTop = this.stickyNode?.getBoundingClientRect()?.top; - let rect = (this.$refs['sticky'] as UniElement).getBoundingClientRect(); + let rect = (this.$refs['sticky'] as Element).getBoundingClientRect(); this.stickyTop = rect.top; } } diff --git a/pages/template/swiper-list/swiper-list.uvue b/pages/template/swiper-list/swiper-list.uvue index edc23653bfb78e17c20554b4e96113cd1963e068..5e1f253a80e7df76fd2f521611d58a4192081929 100644 --- a/pages/template/swiper-list/swiper-list.uvue +++ b/pages/template/swiper-list/swiper-list.uvue @@ -46,8 +46,8 @@ return { swiperList: [] as SwiperViewItem[], swiperIndex: -1, - $tabScrollView: null as null | UniElement, - $indicatorNode: null as null | UniElement, + $tabScrollView: null as null | Element, + $indicatorNode: null as null | Element, $animationFinishIndex: 0, $swiperWidth: 0, $swiperTabsRect: [] as SwiperTabsItem[] @@ -63,9 +63,9 @@ } }, onReady() { - this.$tabScrollView = this.$refs['tabScroll'] as UniElement - this.$indicatorNode = this.$refs['indicator'] as UniElement - this.$swiperWidth = (this.$refs["swiper"] as UniElement).getBoundingClientRect().width + this.$tabScrollView = this.$refs['tabScroll'] as Element + this.$indicatorNode = this.$refs['indicator'] as Element + this.$swiperWidth = (this.$refs["swiper"] as Element).getBoundingClientRect().width this.cacheTabItemsSize() this.setSwiperIndex(0, true) }, @@ -119,7 +119,7 @@ */ cacheTabItemsSize() { this.$swiperTabsRect.length = 0; - const tabs = this.$refs["swipertab"] as UniElement[] + const tabs = this.$refs["swipertab"] as Element[] tabs.forEach((node) => { this.$swiperTabsRect.push({ x: node.offsetLeft, diff --git a/pages/template/swiper-list2/swiper-list2.uvue b/pages/template/swiper-list2/swiper-list2.uvue index 8327b091bf0a42e1fbfed73e60e0a814cbd7895a..3f8f7a3533c10a80cf164dcc63a44085fe3af791 100644 --- a/pages/template/swiper-list2/swiper-list2.uvue +++ b/pages/template/swiper-list2/swiper-list2.uvue @@ -40,7 +40,7 @@ return { swiperList: [] as SwiperViewItem[], swiperIndex: -1, - $tabScrollView: null as null | UniElement, + $tabScrollView: null as null | Element, $animationFinishIndex: 0, $swiperWidth: 0 } @@ -53,8 +53,8 @@ } }, onReady() { - this.$tabScrollView = this.$refs['tabScroll'] as UniElement - this.$swiperWidth = (this.$refs["swiper"] as UniElement).getBoundingClientRect().width + this.$tabScrollView = this.$refs['tabScroll'] as Element + this.$swiperWidth = (this.$refs["swiper"] as Element).getBoundingClientRect().width this.setSwiperIndex(0, true) }, methods: { @@ -108,7 +108,7 @@ const min_ratio = 1 const max_ratio = 1.3 - const tabs = this.$refs['swipertab'] as UniElement[] + const tabs = this.$refs['swipertab'] as Element[] const current_node = tabs[current_index]! const move_to_node = tabs[move_to_index]!