uview-pro 0.0.22 → 0.0.23

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.
package/changelog.md CHANGED
@@ -1,3 +1,19 @@
1
+ ## 0.0.23(2025-09-15)
2
+
3
+ ### 🐛 Bug Fixes | Bug 修复
4
+
5
+ - **u-collapse:** fix accordion mode ([c411fef](https://github.com/anyup/uView-Pro/commit/c411fef340cff07ab06a64f623741e9c1ad125cb))
6
+
7
+ ### 🚀 Chore | 构建/工程依赖/工具
8
+
9
+ - revert comments ([3eed330](https://github.com/anyup/uView-Pro/commit/3eed330c27a7026eb87cb9ef285d1ecbe6789552))
10
+ - **docs:** 增加贡献者 ([8b9d44e](https://github.com/anyup/uView-Pro/commit/8b9d44e281c02f639079b77b7c32cc0a566b35a1))
11
+ - **docs:** add contributors ([b4035da](https://github.com/anyup/uView-Pro/commit/b4035da5a39acc5ae9dcb13b06143cda6a73fec3))
12
+
13
+ ### 📝 Documentation | 文档
14
+
15
+ - 更新交流群二维码图片 ([00c0581](https://github.com/anyup/uView-Pro/commit/00c058159ea9d169219474728e8b31cdc892ab2c))
16
+
1
17
  ## 0.0.22(2025-09-11)
2
18
 
3
19
  ### 🚀 Chore | 构建/工程依赖/工具
@@ -30,13 +30,13 @@ const props = defineProps(CollapseProps);
30
30
  const emit = defineEmits(['change']);
31
31
 
32
32
  // 子元素集合
33
- const childrens = ref<any[]>([]);
33
+ const children = ref<any[]>([]);
34
34
 
35
35
  /**
36
36
  * 重新初始化一次内部的所有子元素的高度计算,用于异步获取数据渲染的情况
37
37
  */
38
38
  function init() {
39
- childrens.value.forEach((vm, index) => {
39
+ children.value.forEach((vm, index) => {
40
40
  vm.init && vm.init();
41
41
  });
42
42
  }
@@ -49,7 +49,7 @@ function onChange(index: string | number) {
49
49
  }
50
50
 
51
51
  provide('u-collapse', {
52
- childrens,
52
+ children,
53
53
  props,
54
54
  init,
55
55
  onChange
@@ -57,7 +57,7 @@ provide('u-collapse', {
57
57
 
58
58
  defineExpose({
59
59
  props,
60
- childrens,
60
+ children,
61
61
  init,
62
62
  onChange
63
63
  });
@@ -7,11 +7,12 @@
7
7
  </view>
8
8
  <slot v-else name="title" />
9
9
  <view class="u-icon-wrap">
10
- <u-icon v-if="arrow" :color="arrowColor" :class="{ 'u-arrow-down-icon-active': isShow }" class="u-arrow-down-icon" name="arrow-down"></u-icon>
10
+ <u-icon v-if="arrow" :color="arrowColor" :class="{ 'u-arrow-down-icon-active': isShow }" class="u-arrow-down-icon" name="arrow-down" />
11
11
  </view>
12
12
  </template>
13
13
  <slot v-else name="title-all" />
14
14
  </view>
15
+
15
16
  <view class="u-collapse-body" :style="{ height: isShow ? height + 'px' : '0' }">
16
17
  <view class="u-collapse-content" :id="elId" :style="bodyStyle">
17
18
  <slot></slot>
@@ -25,9 +26,7 @@ import { ref, watch, onMounted, useSlots, getCurrentInstance, nextTick, inject }
25
26
  import { $u } from '../..';
26
27
  import { CollapseItemProps } from './types';
27
28
 
28
- defineOptions({
29
- name: 'u-collapse-item'
30
- });
29
+ defineOptions({ name: 'u-collapse-item' });
31
30
 
32
31
  /**
33
32
  * collapseItem 手风琴Item
@@ -44,7 +43,6 @@ defineOptions({
44
43
  * @example <u-collapse-item :title="item.head" v-for="(item, index) in itemList" :key="index">{{item.body}}</u-collapse-item>
45
44
  */
46
45
  const props = defineProps(CollapseItemProps);
47
-
48
46
  const emit = defineEmits(['change']);
49
47
  const slots = useSlots();
50
48
  const instance = getCurrentInstance();
@@ -57,15 +55,17 @@ const bodyStyle = ref<Record<string, any>>({}); // 主体部分样式
57
55
  const itemStyle = ref<Record<string, any>>({}); // 每个item的整体样式
58
56
  const arrowColor = ref(''); // 箭头的颜色
59
57
  const hoverClass = ref(''); // 头部按下时的效果样式类
60
- const arrow = ref(true); // 是否显示右侧箭头
61
- // let parent: any = null
58
+ const accordion = ref(true); // 是否显示右侧箭头
59
+ const arrow = ref(true);
60
+
62
61
  const parent = inject<any>('u-collapse', null);
63
- // 监听 open 属性变化
62
+
64
63
  watch(
65
64
  () => props.open,
66
65
  val => {
67
66
  isShow.value = val;
68
- }
67
+ },
68
+ { immediate: true }
69
69
  );
70
70
 
71
71
  /**
@@ -74,13 +74,16 @@ watch(
74
74
  function init() {
75
75
  if (parent) {
76
76
  // 不存在时才添加本实例
77
- if (!parent.childrens.value.includes(instance?.proxy)) parent.childrens.value.push(instance?.proxy);
77
+ if (!parent.children.value.includes(instance?.exposed)) {
78
+ parent.children.value.push(instance?.exposed);
79
+ }
78
80
  headStyle.value = parent.props.headStyle;
79
81
  bodyStyle.value = parent.props.bodyStyle;
80
82
  arrowColor.value = parent.props.arrowColor;
81
83
  hoverClass.value = parent.props.hoverClass;
82
84
  arrow.value = parent.props.arrow;
83
85
  itemStyle.value = parent.props.itemStyle;
86
+ accordion.value = parent.props.accordion;
84
87
  }
85
88
  elId.value = $u.guid();
86
89
  nextTick(() => {
@@ -89,17 +92,31 @@ function init() {
89
92
  }
90
93
 
91
94
  /**
92
- * 点击collapsehead头部
95
+ * 点击collapse head头部
93
96
  */
94
97
  function headClick() {
95
98
  if (props.disabled) return;
96
- isShow.value = !isShow.value;
97
- // 触发本组件的事件
98
- emit('change', {
99
- index: props.index,
100
- show: isShow.value
101
- });
102
- // 只有在打开时才发出事件
99
+
100
+ if (accordion.value && parent) {
101
+ parent.children.value.forEach((vm: any) => {
102
+ if (vm.elId !== elId.value) {
103
+ vm.isShow = false;
104
+ } else {
105
+ vm.isShow = !vm.isShow;
106
+ emit('change', {
107
+ index: props.index,
108
+ show: vm.isShow
109
+ });
110
+ }
111
+ });
112
+ } else {
113
+ isShow.value = !isShow.value;
114
+ emit('change', {
115
+ index: props.index,
116
+ show: isShow.value
117
+ });
118
+ }
119
+
103
120
  if (isShow.value) parent && parent.onChange && parent.onChange(props.index);
104
121
  }
105
122
 
@@ -117,6 +134,7 @@ function queryRect() {
117
134
  onMounted(() => {
118
135
  init();
119
136
  });
137
+
120
138
  defineExpose({
121
139
  init,
122
140
  isShow,
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "id": "uview-pro",
3
3
  "name": "uview-pro",
4
4
  "displayName": "【Vue3重构版】uView Pro|基于Vue3+TS全面重构的70+精选UI组件库",
5
- "version": "0.0.22",
5
+ "version": "0.0.23",
6
6
  "description": "uView Pro,是全面支持Vue3的uni-app生态框架,70+精选组件已使用TypeScript重构,已全面支持uni-app Vue3.0",
7
7
  "main": "index.ts",
8
8
  "module": "index.ts",
package/readme.md CHANGED
@@ -69,7 +69,7 @@ pnpm dev
69
69
 
70
70
  <table class="table">
71
71
  <tr>
72
- <td><img src="https://ik.imagekit.io/anyup/images/social/weixin-chat.png?updatedAt=1757299344899" width="250" height="345" ></td>
72
+ <td><img src="https://ik.imagekit.io/anyup/images/social/weixin-chat.png?updatedAt=1757940337724" width="250" height="345" ></td>
73
73
  <td><img src="https://ik.imagekit.io/anyup/images/social/qq-chat.png" width="250" height="345" ></td>
74
74
  </tr>
75
75
  <tr>
@@ -217,6 +217,12 @@ export function createApp() {
217
217
  </tr>
218
218
  </table>
219
219
 
220
+ ## 贡献者
221
+
222
+ <a href="https://github.com/anyup/uView-Pro/graphs/contributors">
223
+ <img alt="Contributors" src="https://contrib.rocks/image?repo=anyup/uView-Pro" />
224
+ </a>
225
+
220
226
  ## 版权信息
221
227
 
222
228
  `uView Pro` 遵循[MIT](https://en.wikipedia.org/wiki/MIT_License)开源协议,意味着您无需支付任何费用,也无需授权,即可将 `uView Pro` 应用到您的产品中。