wui-components-v2 1.2.17 → 1.2.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,12 @@ import { useRouter } from 'uni-mini-router'
4
4
  defineOptions({
5
5
  name: 'ListTopButtons',
6
6
  })
7
- const props = defineProps<{ mainCode: string, buttons: string[], sourceId: string, id?: string, pageTitle: string, pageType?: string, addEvent?: string, config?: any }>()
7
+ const props = withDefaults(
8
+ defineProps<{ mainCode: string, buttons: string[], sourceId: string, id?: string, pageTitle: string, pageType?: string, addEvent?: string, config?: any, showButtons?: boolean }>(),
9
+ {
10
+ showButtons: true,
11
+ }
12
+ )
8
13
  const router = useRouter()
9
14
  // 跳转添加页面
10
15
  function gotoAddPage() {
@@ -13,7 +18,7 @@ function gotoAddPage() {
13
18
  </script>
14
19
 
15
20
  <template>
16
- <view class="flex justify-end gap-1 py-2 px-2 bg-white dark:bg-[var(--wot-dark-background)]">
21
+ <view v-if="showButtons" class="flex justify-end gap-1 py-2 px-2 bg-white dark:bg-[var(--wot-dark-background)]">
17
22
  <wd-button class="flex-1" v-if="buttons.includes('dtmplAdd')" type="primary" @click="gotoAddPage" icon="plus">{{ props.config?.editBtnTitle || '新增' }}</wd-button>
18
23
  </view>
19
24
  </template>
@@ -24,10 +24,16 @@ withDefaults(
24
24
  * 不传时默认 2;传 0 表示只显示标题、不展示任何字段数据。
25
25
  */
26
26
  collapseNum?: number
27
+ /**
28
+ * 顶部操作按钮区(新增等)是否显示,默认显示。
29
+ */
30
+ showTopButtons?: boolean
27
31
  }>(),
28
32
  {
29
33
  // 操作按钮区域(编辑/删除/morebutns)默认显示
30
34
  isShowAction: true,
35
+ // 顶部操作按钮区默认显示
36
+ showTopButtons: true,
31
37
  }
32
38
  )
33
39
 
@@ -206,6 +212,7 @@ function tabSearchClick(data: any) {
206
212
  :page-title="pageTitle"
207
213
  :page-type="pageType"
208
214
  :config="config"
215
+ :show-buttons="showTopButtons"
209
216
  />
210
217
  </view>
211
218
  <!-- 自定义tab搜索 -->
@@ -32,7 +32,7 @@ const { currentThemeColor } = useManualTheme()
32
32
  </script>
33
33
 
34
34
  <template>
35
- <view class="h-[calc(100vh-44px)] flex flex-col" :style="{ backgroundColor: currentThemeColor.primary }">
35
+ <view class="wui-custom-login flex flex-col" :style="{ backgroundColor: currentThemeColor.primary }">
36
36
  <!-- <view class="flex flex-col items-center justify-center pa-3 pb-5">
37
37
  <wd-img :width="100" :height="100" round :src="loginlog" />
38
38
  <view class="text-center">
@@ -1,4 +1,4 @@
1
- import { computed, onBeforeMount, onUnmounted, ref } from 'vue'
1
+ import { computed, onBeforeMount, ref } from 'vue'
2
2
  import { onShow } from '@dcloudio/uni-app'
3
3
  import { useManualThemeStore } from '../store/manualThemeStore'
4
4
  import { useLocale } from './useLocale'
@@ -117,15 +117,6 @@ export function useManualTheme() {
117
117
  // 组件挂载前初始化主题
118
118
  onBeforeMount(() => {
119
119
  initTheme()
120
-
121
- // 监听系统主题变化
122
- if (typeof uni !== 'undefined' && uni.onThemeChange) {
123
- uni.onThemeChange((res) => {
124
- if (store.followSystem) {
125
- toggleTheme(res.theme as ThemeMode)
126
- }
127
- })
128
- }
129
120
  })
130
121
 
131
122
  // 页面显示时更新导航栏颜色,确保每次切换页面时导航栏颜色都是正确的
@@ -133,17 +124,6 @@ export function useManualTheme() {
133
124
  store.setNavigationBarColor()
134
125
  })
135
126
 
136
- // 组件卸载时清理监听
137
- onUnmounted(() => {
138
- if (typeof uni !== 'undefined' && uni.offThemeChange) {
139
- uni.offThemeChange((res) => {
140
- if (store.followSystem) {
141
- toggleTheme(res.theme as ThemeMode)
142
- }
143
- })
144
- }
145
- })
146
-
147
127
  return {
148
128
  // 状态
149
129
  theme: computed(() => store.theme),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.2.17",
3
+ "version": "1.2.19",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",
@@ -8,7 +8,7 @@ import { LocaleOptions, themeColorOptions } from '../composables/types/theme'
8
8
  export const useManualThemeStore = defineStore('manualTheme', {
9
9
  state: (): ThemeState => ({
10
10
  theme: 'light',
11
- followSystem: true, // 是否跟随系统主题
11
+ followSystem: false, // 是否跟随系统主题(已关闭:不再读取设备系统主题色)
12
12
  hasUserSet: false, // 用户是否手动设置过主题
13
13
  currentThemeColor: themeColorOptions[0],
14
14
  Locale: LocaleOptions[0],
@@ -112,30 +112,10 @@ export const useManualThemeStore = defineStore('manualTheme', {
112
112
 
113
113
  /**
114
114
  * 初始化主题
115
+ * 注:不再读取设备的系统主题色,直接使用已存储/默认主题
115
116
  */
116
117
  initTheme() {
117
- // 如果用户已手动设置且不跟随系统,保持当前主题
118
- if (this.hasUserSet && !this.followSystem) {
119
- console.log('使用用户设置的主题:', this.theme)
120
- this.setNavigationBarColor()
121
- return
122
- }
123
-
124
- // 获取系统主题
125
- const systemTheme = this.getSystemTheme()
126
-
127
- // 如果是首次启动或跟随系统,使用系统主题
128
- if (!this.hasUserSet || this.followSystem) {
129
- this.theme = systemTheme
130
- if (!this.hasUserSet) {
131
- this.followSystem = true
132
- // console.log('首次启动,使用系统主题:', this.theme)
133
- }
134
- else {
135
- console.log('跟随系统主题:', this.theme)
136
- }
137
- }
138
-
118
+ console.log('初始化主题:', this.theme)
139
119
  this.setNavigationBarColor()
140
120
  },
141
121