stellar-ui-plus 1.24.27 → 1.25.0

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.
@@ -16,7 +16,7 @@ export default {
16
16
  default: '',
17
17
  validator: (value: string) => {
18
18
  return typeof value === 'string' && value.length > 0;
19
- }
19
+ },
20
20
  },
21
21
  clientSecret: {
22
22
  type: String,
@@ -24,7 +24,7 @@ export default {
24
24
  default: '',
25
25
  validator: (value: string) => {
26
26
  return typeof value === 'string' && value.length > 0;
27
- }
27
+ },
28
28
  },
29
29
  apiUrl: {
30
30
  type: String,
@@ -34,37 +34,37 @@ export default {
34
34
  try {
35
35
  new URL(value);
36
36
  return true;
37
- } catch {
37
+ } catch (e) {
38
38
  return false;
39
39
  }
40
- }
40
+ },
41
41
  },
42
42
  appType: {
43
43
  type: String,
44
44
  default: '',
45
45
  validator: (value: string) => {
46
46
  return typeof value === 'string';
47
- }
47
+ },
48
48
  },
49
49
  btnText: {
50
50
  type: String,
51
51
  default: '立即体验',
52
52
  validator: (value: string) => {
53
53
  return typeof value === 'string' && value.length > 0;
54
- }
54
+ },
55
55
  },
56
56
  appVersion: {
57
57
  type: String,
58
58
  default: '',
59
59
  validator: (value: string) => {
60
60
  return typeof value === 'string';
61
- }
61
+ },
62
62
  },
63
63
  zIndex: {
64
64
  type: [Number, String],
65
65
  default: () => 998,
66
66
  validator: (value: any) => {
67
- return typeof value === 'number' || typeof value === 'string'
68
- }
69
- }
70
- } satisfies Record<keyof AppUpdateProps, any>;
67
+ return typeof value === 'number' || typeof value === 'string';
68
+ },
69
+ },
70
+ } satisfies Record<keyof AppUpdateProps, any>;
@@ -249,7 +249,7 @@
249
249
  | 参数 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
250
250
  | ------------------- | --------------------------------- | --------------- | --------- | --------------------------------- | --------- |
251
251
  | `value` | 当前选中值(支持v-model双向绑定) | `String` | `` | - | - |
252
- | `direction` | 排列方式 | `String` | `row` | `column`:横向 <br/>`row`:纵向 | - |
252
+ | `direction` | 排列方式 | `String` | `column` | `row`:横向 <br/>`column`:纵向 | - |
253
253
  | `disabled` | 是否禁用 | `Boolean` | `false` | - | - |
254
254
  | `readonly` | 只读 (不置灰) | `Boolean` | `false` | - | - |
255
255
  | `shape` | 形状 | `String` | `circle` | `circle`:圆形 <br/>`squar`:方形 | - |
@@ -44,6 +44,7 @@ const cmpRootStyle = computed(() => {
44
44
  flexDirection: textPosition === 'right' ? 'row' : 'row-reverse',
45
45
  marginLeft: utils.formatPx(getDefaultData('marginLeft', '0')),
46
46
  marginRight: utils.formatPx(getDefaultData('marginRight', '0')),
47
+ columnGap: utils.formatPx(getDefaultData('columnGap', '16')),
47
48
  };
48
49
 
49
50
  // #ifdef H5
@@ -62,12 +63,6 @@ const cmpRootStyle = computed(() => {
62
63
  return style;
63
64
  });
64
65
 
65
- const cmpIconStyle = computed(() => {
66
- return {
67
- marginRight: utils.formatPx(getDefaultData('columnGap', '16')),
68
- } as CSSProperties;
69
- });
70
-
71
66
  const cmpInputStyle = computed(() => {
72
67
  const shape = getDefaultData('shape', 'circle');
73
68
  const iconSize = getDefaultData('iconSize', 36);
@@ -162,7 +157,7 @@ const getDefaultData = <T,>(key: PropsKeyType, defaultValue: T): T => {
162
157
 
163
158
  <template>
164
159
  <view class="ste-radio-root" :style="[cmpRootStyle]" @click="click">
165
- <view class="icon" :style="[cmpIconStyle]">
160
+ <view class="icon">
166
161
  <slot name="icon" :slotProps="cmpSlotProps">
167
162
  <view class="input-icon" :style="[cmpInputStyle]">
168
163
  <ste-icon v-if="cmpChecked" :size="cmpIconProps.size" code="&#xe67a;" :color="cmpIconProps.color" bold></ste-icon>
@@ -28,7 +28,8 @@ function updateValue(value: string) {
28
28
 
29
29
  <style lang="scss" scoped>
30
30
  .ste-radio-group-root {
31
- display: grid;
31
+ display: flex;
32
+ column-gap: 16rpx;
32
33
  row-gap: 16rpx;
33
34
  }
34
35
  </style>
@@ -0,0 +1,7 @@
1
+ #### Props
2
+ | 属性名 | 说明 | 类型 | 默认值 | 可选值 | 支持版本 |
3
+ | ----- | ----- | --- | ------- | ------ | -------- |
4
+ | `loading` | 是否显示骨架图 | `boolean` | `true` | - | - |
5
+ | `type` | 骨架图类型 | `string` | `text` | `text`:文本<br/>`image`:图片<br/>`circle`:圆形<br/>`button`:按钮 | - |
6
+
7
+
@@ -6,6 +6,19 @@
6
6
 
7
7
  ### 代码演示
8
8
 
9
+ JavaScript后面的演示代码中涉及到的变量和方法都使用本`javascript`代码
10
+
11
+ ```javascript
12
+ import { ref, onMounted } from 'vue';
13
+ const loading = ref(true);
14
+
15
+ onMounted(() => {
16
+ setTimeout(() => {
17
+ loading.value = false;
18
+ }, 3000);
19
+ });
20
+ ```
21
+
9
22
  #### 骨架类型
10
23
 
11
24
  通过`type`属性,设置骨架图类型
@@ -17,7 +30,7 @@
17
30
  ```html
18
31
  <template>
19
32
  <!-- 显示骨架图 -->
20
- <ste-skeleton loading>
33
+ <ste-skeleton :loading="loading">
21
34
  <ste-text>床前明月光,疑是地上霜。</ste-text>
22
35
  </ste-skeleton>
23
36
 
@@ -28,6 +41,30 @@
28
41
  </template>
29
42
  ```
30
43
 
44
+ ##### 图片骨架
45
+
46
+ 适用于矩形图片的骨架展示:
47
+
48
+ ```html
49
+ <template>
50
+ <ste-skeleton :loading="loading" type="image">
51
+ <ste-image src="https://image.whzb.com/chain/StellarUI/图片.jpg" width="120" height="120" />
52
+ </ste-skeleton>
53
+ </template>
54
+ ```
55
+
56
+ ##### 圆形头像骨架
57
+
58
+ 适用于圆形头像或图标的骨架展示:
59
+
60
+ ```html
61
+ <template>
62
+ <ste-skeleton :loading="loading" type="circle">
63
+ <ste-image src="https://image.whzb.com/chain/StellarUI/图片.jpg" width="120" height="120" radius="50" />
64
+ </ste-skeleton>
65
+ </template>
66
+ ```
67
+
31
68
  ---$
32
69
 
33
70
  ### API
@@ -3,11 +3,10 @@
3
3
  class="ste-skeleton"
4
4
  :class="[
5
5
  {
6
- 'is-loading': loading,
6
+ 'ste-skeleton--loading': loading,
7
7
  },
8
8
  `ste-skeleton--${type}`,
9
9
  ]"
10
- ref="skeletonRef"
11
10
  >
12
11
  <template v-if="loading">
13
12
  <ste-icon v-if="type == 'image'" :size="20" code="&#xe693;"></ste-icon>
@@ -20,89 +19,72 @@
20
19
  </template>
21
20
 
22
21
  <script setup lang="ts">
23
- import { computed, onMounted, ref, watch, type PropType } from 'vue';
24
22
  import propsData from './props';
25
-
26
23
  const componentName = `ste-skeleton`;
27
24
 
28
25
  defineOptions({
29
26
  name: componentName,
30
27
  });
31
28
  const props = defineProps(propsData);
32
-
33
- // 组件引用
34
- let skeletonRef: any = ref(null);
35
-
36
- // 动画实例
37
- let animation: null = null;
38
-
39
- // 开始动画
40
- // function start() {
41
- // if (!props.loading) return;
42
-
43
- // animation = createAnimation(skeletonRef.value, {
44
- // duration: 2000,
45
- // loop: -1,
46
- // alternate: true,
47
- // })
48
- // .opacity('0.3', '1')
49
- // .play();
50
- // }
51
-
52
- // // 停止动画
53
- // function stop() {
54
- // if (animation != null) {
55
- // animation!.stop();
56
- // animation!.reset();
57
- // }
58
- // }
59
-
60
- // onMounted(() => {
61
- // watch(
62
- // computed(() => props.loading),
63
- // (val: boolean) => {
64
- // if (val) {
65
- // start();
66
- // } else {
67
- // stop();
68
- // }
69
- // },
70
- // {
71
- // immediate: true,
72
- // }
73
- // );
74
- // });
75
29
  </script>
76
30
 
77
31
  <style lang="scss" scoped>
78
32
  .ste-skeleton {
79
- &.is-loading {
80
- @apply bg-surface-100 rounded-md;
33
+ &.ste-skeleton--loading {
34
+ background-color: #fafafb;
35
+ border-radius: 8rpx;
81
36
 
82
37
  &.ste-skeleton--text {
83
- height: 16px;
84
- width: 150px;
85
- border-radius: 4px;
38
+ height: 32rpx;
39
+ width: 300rpx;
40
+ border-radius: 8rpx;
86
41
  }
87
42
 
88
43
  &.ste-skeleton--image {
89
- @apply flex flex-row items-center justify-center;
90
- width: 60px;
91
- height: 60px;
92
- border-radius: 8px;
44
+ display: flex;
45
+ align-items: center;
46
+ justify-content: center;
47
+ flex-direction: row;
48
+ width: 120rpx;
49
+ height: 120rpx;
50
+ border-radius: 16rpx;
93
51
  }
94
52
 
95
53
  &.ste-skeleton--circle {
96
- @apply rounded-full;
97
- width: 60px;
98
- height: 60px;
54
+ border-radius: 50%;
55
+ width: 120rpx;
56
+ height: 120rpx;
99
57
  }
100
58
 
101
59
  &.ste-skeleton--button {
102
- @apply rounded-lg;
103
- height: 32px;
104
- width: 88px;
60
+ border-radius: 16rpx;
61
+ height: 64rpx;
62
+ width: 176rpx;
105
63
  }
106
64
  }
107
65
  }
66
+
67
+ /* 定义骨架屏闪烁动画 */
68
+ @keyframes skeleton-blink {
69
+ 0% {
70
+ opacity: 0.3;
71
+ }
72
+ 100% {
73
+ opacity: 1;
74
+ }
75
+ }
76
+
77
+ /* 骨架屏基础样式与动画绑定 */
78
+ .ste-skeleton--loading {
79
+ /* 对应 duration: 2000ms */
80
+ animation-duration: 2s;
81
+ /* 对应 loop: -1 (无限循环) */
82
+ animation-iteration-count: infinite;
83
+ /* 对应 alternate: true (交替方向) */
84
+ animation-direction: alternate;
85
+ /* 动画名称 */
86
+ animation-name: skeleton-blink;
87
+ /* 保证动画平滑过渡 */
88
+ animation-timing-function: ease-in-out;
89
+ }
108
90
  </style>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "stellar-ui-plus",
3
- "version": "1.24.27",
3
+ "version": "1.25.0",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "license": "MIT",