From 2cc075ee270c48aaefd79a354eec58d75fe509aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=8F=B2=E9=B8=BD?= <1020103647@qq.com> Date: Fri, 1 Mar 2024 20:21:32 +0800 Subject: [PATCH] feat: delete useless files --- src/hooks/useNavbarWeixin.ts | 62 ------------------------------------ src/hooks/useWeixinShare.ts | 25 --------------- src/pages-sub/demo/index.vue | 13 -------- src/store/count.ts | 28 ---------------- src/store/index.ts | 2 -- 5 files changed, 130 deletions(-) delete mode 100644 src/hooks/useNavbarWeixin.ts delete mode 100644 src/hooks/useWeixinShare.ts delete mode 100644 src/store/count.ts diff --git a/src/hooks/useNavbarWeixin.ts b/src/hooks/useNavbarWeixin.ts deleted file mode 100644 index e8f7aff..0000000 --- a/src/hooks/useNavbarWeixin.ts +++ /dev/null @@ -1,62 +0,0 @@ -import { onReady } from '@dcloudio/uni-app' -import { getIsTabbar } from '@/utils/index' - -export default () => { - // 获取页面栈 - const pages = getCurrentPages() - const isTabbar = getIsTabbar() - - // 页面滚动到底部时的操作,通常用于加载更多数据 - const onScrollToLower = () => {} - // 获取屏幕边界到安全区域距离 - const { safeAreaInsets } = uni.getSystemInfoSync() - - // #ifdef MP-WEIXIN - // 基于小程序的 Page 类型扩展 uni-app 的 Page - type PageInstance = Page.PageInstance & WechatMiniprogram.Page.InstanceMethods - // 获取当前页面实例,数组最后一项 - const pageInstance = getCurrentPages().at(-1) as PageInstance - - // 页面渲染完毕,绑定动画效果 - onReady(() => { - // 动画效果,导航栏背景色 - pageInstance.animate( - '.fly-navbar', - [{ backgroundColor: 'transparent' }, { backgroundColor: '#f8f8f8' }], - 1000, - { - scrollSource: '#scroller', - timeRange: 1000, - startScrollOffset: 0, - endScrollOffset: 50, - }, - ) - // 动画效果,导航栏标题 - pageInstance.animate( - '.fly-navbar .title', - [{ color: 'transparent' }, { color: '#000' }], - 1000, - { - scrollSource: '#scroller', - timeRange: 1000, - startScrollOffset: 0, - endScrollOffset: 50, - }, - ) - // 动画效果,导航栏返回按钮 - pageInstance.animate('.fly-navbar .left-icon', [{ color: '#fff' }, { color: '#000' }], 1000, { - scrollSource: '#scroller', - timeRange: 1000, - startScrollOffset: 0, - endScrollOffset: 50, - }) - }) - // #endif - - return { - pages, - isTabbar, - onScrollToLower, - safeAreaInsets, - } -} diff --git a/src/hooks/useWeixinShare.ts b/src/hooks/useWeixinShare.ts deleted file mode 100644 index 47880c2..0000000 --- a/src/hooks/useWeixinShare.ts +++ /dev/null @@ -1,25 +0,0 @@ -import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app' - -export default () => { - return { - /** 激活“分享给好友” */ - onShareAppMessage: onShareAppMessage( - (options: Page.ShareAppMessageOption): Page.CustomShareContent => { - console.log('options:', options) - return { - title: '自定义分享标题', - path: '/pages/index/index?id=xxx', - imageUrl: - 'https://cip-shopping-page-0eysug01066a9e-1302818703.tcloudbaseapp.com/pretty-girl.png', - } - }, - ), - /** 激活“分享到朋友圈”, 注意:需要先激活“分享给好友” */ - onShareTimeline: onShareTimeline((): Page.ShareTimelineContent => { - return { - title: '自定义分享标题', - query: 'a=1&b=2', - } - }), - } -} diff --git a/src/pages-sub/demo/index.vue b/src/pages-sub/demo/index.vue index 1161a25..17164a4 100644 --- a/src/pages-sub/demo/index.vue +++ b/src/pages-sub/demo/index.vue @@ -8,19 +8,6 @@ http://localhost:9000/#/pages-sub/demo/index 分包页面demo - test global css - uvui 引入演示 - - - - - - diff --git a/src/store/count.ts b/src/store/count.ts deleted file mode 100644 index 946ccd7..0000000 --- a/src/store/count.ts +++ /dev/null @@ -1,28 +0,0 @@ -// src/store/useCountStore.ts -import { defineStore } from 'pinia' -import { ref } from 'vue' - -export const useCountStore = defineStore( - 'count', - () => { - const count = ref(0) - const increment = () => { - count.value++ - } - const decrement = () => { - count.value-- - } - const reset = () => { - count.value = 0 - } - return { - count, - decrement, - increment, - reset, - } - }, - { - persist: true, - }, -) diff --git a/src/store/index.ts b/src/store/index.ts index 74cb584..74b1b2f 100644 --- a/src/store/index.ts +++ b/src/store/index.ts @@ -1,4 +1,3 @@ -// src/store/index.ts import { createPinia } from 'pinia' import { createPersistedState } from 'pinia-plugin-persistedstate' // 数据持久化 @@ -16,4 +15,3 @@ export default store // 模块统一导出 export * from './user' -export * from './count'