diff --git a/src/composables/useActivityNav.ts b/src/composables/useActivityNav.ts index 2912b15..2b472ea 100644 --- a/src/composables/useActivityNav.ts +++ b/src/composables/useActivityNav.ts @@ -8,11 +8,13 @@ export const useActivityNav = () => { const store = useRootStore() const { shopList } = storeToRefs(store) + const NO_POINT_TYPE = -1 + function nav(activity: Activity) { let shop if (activity.shopCode.length) { shop = shopList.value.find(item => item.shopCode === activity?.shopCode) - } else if (activity.point > -1) { + } else if (activity.point > NO_POINT_TYPE) { const { activityName, floorOrder, floor, point, fileUrl, activityId } = activity shop = new Brand({ shopName: activityName, floorOrder, floor, logoUrl: fileUrl, yaxis: point, shopCode: activityId }) } diff --git a/src/composables/useFacilityNav.ts b/src/composables/useFacilityNav.ts index f068460..de098c9 100644 --- a/src/composables/useFacilityNav.ts +++ b/src/composables/useFacilityNav.ts @@ -8,11 +8,11 @@ export const useFacilityNav = () => { function handleFacility({ abbreviation, customFacilityName, filePath, code }: Facility) { const { floor, node } = window.Map_QM.pathIcon({ type: abbreviation }) - const floorName = store.currentBuildingFloorsList.find(_floor => _floor.floorOrder === floor)?.floor + const floorName = store.currentBuildingFloorsList.find(_floor => _floor.floorOrder === floor)?.floor ?? '' const shop = new Brand({ shopName: customFacilityName, floorOrder: floor, - floor: floorName as string, + floor: floorName, logoUrl: filePath, yaxis: node, shopCode: code diff --git a/src/composables/usePage.ts b/src/composables/usePage.ts index 45d4656..034e534 100644 --- a/src/composables/usePage.ts +++ b/src/composables/usePage.ts @@ -1,12 +1,13 @@ -import { ref, shallowRef, watch, toRaw, nextTick, onBeforeUnmount, type ShallowRef } from 'vue' +import { ref, shallowRef, watch, toRaw, nextTick, onBeforeUnmount } from 'vue' +import type { ShallowRef } from 'vue' +type PageList = { name: string; shopList: Shop[] } /** * @param {array} totalList 分页数据源 * @param {*} scroll 滚动组件的实例 * @return {*} { scrollEnd, pageList, loaded } */ -type PageList = { name: string; shopList: Shop[] } -export const usePage = (totalList: PageList[], scroll: ShallowRef) => { +export const usePage = (totalList: ShallowRef, scroll: any) => { if (typeof Worker === 'undefined') { alert('抱歉,当前运行环境不支持Web Worker API, 请升级浏览器版本') } @@ -27,16 +28,10 @@ export const usePage = (totalList: PageList[], scroll: ShallowRef) => { function scrollEnd() { worker.value?.postMessage('scrollEnd') } - watch( - totalList, - newVal => { - const rawList = newVal.map(item => toRaw(item)) - worker.value?.postMessage(rawList) - }, - { - immediate: true - } - ) + watch(totalList, newVal => { + const rawList = newVal.map(item => toRaw(item)) + worker.value?.postMessage(rawList) + }) onBeforeUnmount(() => { worker.value?.terminate()