stellar-ui-plus 1.16.19 → 1.17.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.
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { computed, defineOptions, type CSSProperties } from 'vue';
3
- import useColor from '../../config/color';
4
- let color = useColor();
3
+ import { useColorStore } from '../../store/color';
4
+ let { getColor } = useColorStore();
5
5
  import propsData from './props';
6
6
  import utils from '../../utils/utils';
7
7
  import type {
@@ -109,7 +109,7 @@ const cmpBtnStyle = computed(() => {
109
109
  break;
110
110
  }
111
111
  // 背景色 & 字体色
112
- style = { ...style, ...utils.bg2style(props.background ? props.background : color.getColor().steThemeColor) };
112
+ style = { ...style, ...utils.bg2style(props.background ? props.background : getColor().steThemeColor) };
113
113
  style.color = props.color;
114
114
 
115
115
  // 禁用 disabled | 加载 loading
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import { watch, onMounted, computed } from 'vue';
3
- import useColor from '../../config/color';
4
- let color = useColor();
3
+ import { useColorStore } from '../../store/color';
4
+ let { getColor } = useColorStore();
5
5
  import { formatDate, type WeekType } from './date';
6
6
  import utils from '../../utils/utils';
7
7
  import useData from './useData';
@@ -13,10 +13,10 @@ const props = defineProps(propsData);
13
13
  const cmpRootStyle = computed(() => ({
14
14
  '--calendar-width': utils.formatPx(props.width),
15
15
  '--calendar-height': utils.formatPx(props.height),
16
- '--calendar-color': props.color ? props.color : color.getColor().steThemeColor,
17
- '--calendar-bg-color': utils.Color.formatColor(props.color ? props.color : color.getColor().steThemeColor, 0.1),
18
- '--calendar-range-color': utils.Color.formatColor(props.color ? props.color : color.getColor().steThemeColor, 0.2),
19
- '--calendar-disabled-color': utils.Color.formatColor(props.color ? props.color : color.getColor().steThemeColor, 0.3),
16
+ '--calendar-color': props.color ? props.color : getColor().steThemeColor,
17
+ '--calendar-bg-color': utils.Color.formatColor(props.color ? props.color : getColor().steThemeColor, 0.1),
18
+ '--calendar-range-color': utils.Color.formatColor(props.color ? props.color : getColor().steThemeColor, 0.2),
19
+ '--calendar-disabled-color': utils.Color.formatColor(props.color ? props.color : getColor().steThemeColor, 0.3),
20
20
  '--calendar-start-text': `"${props.startText}"`,
21
21
  '--calendar-end-text': `"${props.endText}"`,
22
22
  }));
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { useSlots, computed, ref, type CSSProperties } from 'vue';
3
- import useColor from '../../config/color';
4
- let color = useColor();
3
+ import { useColorStore } from '../../store/color';
4
+ let { getColor } = useColorStore();
5
5
  import utils from '../../utils/utils';
6
6
  import propsData, { CHECKBOX_KEY, type CheckboxEmits } from './props';
7
7
  import type { CheckboxGroupProps } from '../ste-checkbox-group/props';
@@ -23,7 +23,7 @@ const parentProps = computed(() => Parent?.parent?.props);
23
23
  const cmpReadonly = computed(() => getDefaultData('readonly', false));
24
24
  const cmpShape = computed(() => getDefaultData('shape', 'circle'));
25
25
  const cmpIconSize = computed(() => getDefaultData('iconSize', 36));
26
- const cmpCheckedColor = computed(() => getDefaultData('checkedColor', color.getColor().steThemeColor));
26
+ const cmpCheckedColor = computed(() => getDefaultData('checkedColor', getColor().steThemeColor));
27
27
  const cmpTextPosition = computed(() => getDefaultData('textPosition', 'right'));
28
28
  const cmpTextSize = computed(() => getDefaultData('textSize', 28));
29
29
  const cmpTextInactiveColor = computed(() => getDefaultData('textInactiveColor', '#000000'));
@@ -22,8 +22,8 @@
22
22
 
23
23
  <script lang="ts" setup>
24
24
  import { ref, onMounted, nextTick, defineOptions, computed } from 'vue';
25
- import useColor from '../../config/color';
26
- let color = useColor();
25
+ import { useColorStore } from '../../store/color';
26
+ let { getColor } = useColorStore();
27
27
  import propsData from './props';
28
28
  import type { CloumnType } from './types';
29
29
  import utils from '../../utils/utils';
@@ -37,7 +37,7 @@ defineOptions({
37
37
  const props = defineProps(propsData);
38
38
 
39
39
  let cmpConfirmColor = computed(() => {
40
- return props.confirmColor ? props.confirmColor : color.getColor().steThemeColor;
40
+ return props.confirmColor ? props.confirmColor : getColor().steThemeColor;
41
41
  });
42
42
 
43
43
  const DEFAULT_DATE = dayjs(new Date(1970, 1, 1, 0, 0, 0));
@@ -7,8 +7,8 @@ import type { DropdownItem } from '../ste-dropdown-menu-item/type';
7
7
  import { type DropdownMenuItemProps } from '../ste-dropdown-menu-item/props';
8
8
  import utils from '../../utils/utils';
9
9
  import System from '../../utils/System.js';
10
- import useColor from '../../config/color';
11
- let color = useColor();
10
+ import { useColorStore } from '../../store/color';
11
+ let { getColor } = useColorStore();
12
12
 
13
13
  const props = defineProps(propsData);
14
14
  const emits = defineEmits(dropDownMenuEmits);
@@ -44,7 +44,7 @@ const cmpRootClass = computed(() => {
44
44
 
45
45
  const cmpRootStyle = computed(() => ({
46
46
  '--duration': cmpDuration.value + 's',
47
- '--active-color': props.activeColor ? props.activeColor : color.getColor().steThemeColor,
47
+ '--active-color': props.activeColor ? props.activeColor : getColor().steThemeColor,
48
48
  '--inactive-color': props.inactiveColor,
49
49
  '--menu-z-index': props.zIndex,
50
50
  }));
@@ -3,8 +3,8 @@ import { ref, computed, watch, nextTick, getCurrentInstance, defineOptions, onMo
3
3
  import propsData, { INDEX_LIST_KEY } from './props';
4
4
  import useData from '../ste-scroll-to/useData';
5
5
  import { useProvide } from '../../utils/mixin';
6
- import useColor from '../../config/color';
7
- let color = useColor();
6
+ import { useColorStore } from '../../store/color';
7
+ let { getColor } = useColorStore();
8
8
 
9
9
  defineOptions({
10
10
  name: 'ste-index-list',
@@ -38,7 +38,7 @@ const { dataActive, setDataActive, scrollTop, cmpRootStyle, onScroll, initChildr
38
38
 
39
39
  const cmpIndexRootStyle = computed(() => ({
40
40
  '--ste-index-list-inactive-color': props.inactiveColor,
41
- '--ste-index-list-active-color': props.activeColor ? props.activeColor : color.getColor().steThemeColor,
41
+ '--ste-index-list-active-color': props.activeColor ? props.activeColor : getColor().steThemeColor,
42
42
  }));
43
43
  const cmpTitles = computed(() => internalChildren.map(c => c?.props?.title));
44
44
 
@@ -7,8 +7,9 @@ import { ICON_OBJ, ANIMATION_PROP, DURATION } from './constants';
7
7
  import type { MessageBoxOptions } from '../../types';
8
8
  import { STE_MESSAGE_BOX_KEY } from './use-message-box';
9
9
  import { useMsgBoxStore } from '../../store';
10
- import useColor from '../../config/color';
11
- let color = useColor();
10
+ import { useColorStore } from '../../store/color';
11
+ let { getColor } = useColorStore();
12
+
12
13
  defineOptions({
13
14
  name: 'ste-message-box',
14
15
  });
@@ -58,7 +59,7 @@ const cmpRootStyle = computed(() => {
58
59
  return {
59
60
  opacity: 0,
60
61
  '--cancel-color': cancelColor.value,
61
- '--confirm-color': confirmColor.value ? confirmColor.value : color.getColor().steThemeColor,
62
+ '--confirm-color': confirmColor.value ? confirmColor.value : getColor().steThemeColor,
62
63
  };
63
64
  });
64
65
 
@@ -1,144 +1,132 @@
1
- import { computed, ref, watch } from 'vue'
2
- import utils from '../../utils/utils'
3
- import useColor from '../../config/color'
4
- import type { NumberKeyboardProps } from './props'
5
-
6
- const color = useColor()
1
+ import { computed, ref, watch } from 'vue';
2
+ import utils from '../../utils/utils';
3
+ import { useColorStore } from '../../store/color';
4
+ let { getColor } = useColorStore();
5
+ import type { NumberKeyboardProps } from './props';
7
6
  export default function useData({
8
- props,
9
- emits,
7
+ props,
8
+ emits,
10
9
  }: {
11
- props: NumberKeyboardProps
12
- emits: {
13
- (e: 'change', value: string): void
14
- (e: 'input', value: string): void
15
- (e: 'update:modelValue', value: string): void
16
- (e: 'clear'): void
17
- (e: 'backspace'): void
18
- (e: 'confirm', value: string): void
19
- (e: 'click', key: string): void
20
- (e: 'beforeinput', key: string, suspend: () => void, next: () => void, stop: () => void): void
21
- (e: 'close'): void
22
- (e: 'update:show', show: boolean): void
23
- (e: 'open'): void
24
- }
10
+ props: NumberKeyboardProps;
11
+ emits: {
12
+ (e: 'change', value: string): void;
13
+ (e: 'input', value: string): void;
14
+ (e: 'update:modelValue', value: string): void;
15
+ (e: 'clear'): void;
16
+ (e: 'backspace'): void;
17
+ (e: 'confirm', value: string): void;
18
+ (e: 'click', key: string): void;
19
+ (e: 'beforeinput', key: string, suspend: () => void, next: () => void, stop: () => void): void;
20
+ (e: 'close'): void;
21
+ (e: 'update:show', show: boolean): void;
22
+ (e: 'open'): void;
23
+ };
25
24
  }) {
26
- const dataValue = ref('')
27
- const setDataValue = (value: string) => {
28
- if (value === dataValue.value)
29
- return
30
- if (value === null || value === undefined)
31
- dataValue.value = ''
32
- else if (typeof value === 'string')
33
- dataValue.value = value
34
- else dataValue.value = String(value)
35
- }
25
+ const dataValue = ref('');
26
+ const setDataValue = (value: string) => {
27
+ if (value === dataValue.value) return;
28
+ if (value === null || value === undefined) dataValue.value = '';
29
+ else if (typeof value === 'string') dataValue.value = value;
30
+ else dataValue.value = String(value);
31
+ };
36
32
 
37
- const dataShow = ref(false)
38
- const setDataShow = (value: boolean) => {
39
- if (value === dataShow.value)
40
- return
41
- dataShow.value = value
42
- }
33
+ const dataShow = ref(false);
34
+ const setDataShow = (value: boolean) => {
35
+ if (value === dataShow.value) return;
36
+ dataShow.value = value;
37
+ };
43
38
 
44
- const cmpNumbers = computed(() => {
45
- let keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0']
46
- if (props.randomKeys)
47
- keys = utils.randomArray(keys)
39
+ const cmpNumbers = computed(() => {
40
+ let keys = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '0'];
41
+ if (props.randomKeys) keys = utils.randomArray(keys);
48
42
 
49
- if (Array.isArray(props.customKeys))
50
- keys.push(...props.customKeys)
43
+ if (Array.isArray(props.customKeys)) keys.push(...props.customKeys);
51
44
 
52
- if (!props.rightKeys) {
53
- if (!props.showClear) {
54
- keys.push('backspace')
55
- return
56
- }
57
- const d = keys.length % 3
58
- if (d === 1) {
59
- const end = keys.pop()
60
- keys.push('clear', end || '', 'backspace')
61
- }
62
- else {
63
- keys.push('clear', 'backspace')
64
- }
65
- }
66
- return keys
67
- })
45
+ if (!props.rightKeys) {
46
+ if (!props.showClear) {
47
+ keys.push('backspace');
48
+ return;
49
+ }
50
+ const d = keys.length % 3;
51
+ if (d === 1) {
52
+ const end = keys.pop();
53
+ keys.push('clear', end || '', 'backspace');
54
+ } else {
55
+ keys.push('clear', 'backspace');
56
+ }
57
+ }
58
+ return keys;
59
+ });
68
60
 
69
- const cmpRootStyle = computed(() => {
70
- return {
71
- '--ste-number-keyboard-text-color': props.textColor,
72
- '--ste-number-keyboard-text-size': `var(--font-size-${props.textSize},${utils.formatPx(props.textSize)})`,
73
- '--ste-number-keyboard-clear-text-size': `var(--font-size-${props.textSize},${utils.formatPx(Number(props.textSize) - 8)})`,
74
- '--ste-number-keyboard-confirm-text-size': `var(--font-size-${props.textSize},${utils.formatPx(Number(props.textSize) - 3)})`,
75
- '--ste-number-keyboard-confirm-bg': props.confirmBg ? props.confirmBg : color.getColor().steThemeColor,
76
- '--ste-number-keyboard-confirm-bg-active': utils.Color.formatColor(props.confirmBg, 0.8),
77
- '--ste-number-keyboard-confirm-color': props.confirmColor,
78
- }
79
- })
61
+ const cmpRootStyle = computed(() => {
62
+ return {
63
+ '--ste-number-keyboard-text-color': props.textColor,
64
+ '--ste-number-keyboard-text-size': `var(--font-size-${props.textSize},${utils.formatPx(props.textSize)})`,
65
+ '--ste-number-keyboard-clear-text-size': `var(--font-size-${props.textSize},${utils.formatPx(Number(props.textSize) - 8)})`,
66
+ '--ste-number-keyboard-confirm-text-size': `var(--font-size-${props.textSize},${utils.formatPx(Number(props.textSize) - 3)})`,
67
+ '--ste-number-keyboard-confirm-bg': props.confirmBg ? props.confirmBg : getColor().steThemeColor,
68
+ '--ste-number-keyboard-confirm-bg-active': utils.Color.formatColor(props.confirmBg, 0.8),
69
+ '--ste-number-keyboard-confirm-color': props.confirmColor,
70
+ };
71
+ });
80
72
 
81
- watch(() => props.modelValue, setDataValue, { immediate: true })
82
- watch(() => props.show, setDataShow, { immediate: true })
73
+ watch(() => props.modelValue, setDataValue, { immediate: true });
74
+ watch(() => props.show, setDataShow, { immediate: true });
83
75
 
84
- const onClose = () => {
85
- setDataShow(false)
86
- emits('update:show', false)
87
- emits('close')
88
- }
76
+ const onClose = () => {
77
+ setDataShow(false);
78
+ emits('update:show', false);
79
+ emits('close');
80
+ };
89
81
 
90
- const beforInput = async (value: string) => {
91
- let next = true
92
- const stop = new Promise((resolve, reject) => {
93
- emits(
94
- 'beforeinput',
95
- value,
96
- () => (next = false),
97
- () => resolve('next'),
98
- () => reject(new Error('beforInput stop')),
99
- )
100
- })
101
- if (!next)
102
- await stop
82
+ const beforInput = async (value: string) => {
83
+ let next = true;
84
+ const stop = new Promise((resolve, reject) => {
85
+ emits(
86
+ 'beforeinput',
87
+ value,
88
+ () => (next = false),
89
+ () => resolve('next'),
90
+ () => reject(new Error('beforInput stop'))
91
+ );
92
+ });
93
+ if (!next) await stop;
103
94
 
104
- /* eslint prefer-promise-reject-errors: "error" */
105
- }
95
+ /* eslint prefer-promise-reject-errors: "error" */
96
+ };
106
97
 
107
- const onChange = async (value: string) => {
108
- try {
109
- if (value === 'confirm') {
110
- emits('confirm', dataValue.value)
111
- onClose()
112
- return
113
- }
114
- switch (value) {
115
- case 'backspace':
116
- setDataValue(dataValue.value.slice(0, dataValue.value.length - 1))
117
- emits('backspace')
118
- break
119
- case 'clear':
120
- setDataValue('')
121
- emits('clear')
122
- break
123
- default:
124
- await beforInput(value)
125
- emits('click', value)
126
- if (props.maxlength && dataValue.value.length >= Number(props.maxlength))
127
- return
128
- dataValue.value += value
129
- break
130
- }
131
- emits('input', dataValue.value)
132
- emits('change', dataValue.value)
133
- emits('update:modelValue', dataValue.value)
134
- }
135
- catch (e) {
136
- if (e)
137
- console.error(e)
138
- }
139
- }
98
+ const onChange = async (value: string) => {
99
+ try {
100
+ if (value === 'confirm') {
101
+ emits('confirm', dataValue.value);
102
+ onClose();
103
+ return;
104
+ }
105
+ switch (value) {
106
+ case 'backspace':
107
+ setDataValue(dataValue.value.slice(0, dataValue.value.length - 1));
108
+ emits('backspace');
109
+ break;
110
+ case 'clear':
111
+ setDataValue('');
112
+ emits('clear');
113
+ break;
114
+ default:
115
+ await beforInput(value);
116
+ emits('click', value);
117
+ if (props.maxlength && dataValue.value.length >= Number(props.maxlength)) return;
118
+ dataValue.value += value;
119
+ break;
120
+ }
121
+ emits('input', dataValue.value);
122
+ emits('change', dataValue.value);
123
+ emits('update:modelValue', dataValue.value);
124
+ } catch (e) {
125
+ if (e) console.error(e);
126
+ }
127
+ };
140
128
 
141
- const onOpen = () => emits('open')
129
+ const onOpen = () => emits('open');
142
130
 
143
- return { cmpNumbers, cmpRootStyle, dataShow, onClose, onChange, onOpen }
131
+ return { cmpNumbers, cmpRootStyle, dataShow, onClose, onChange, onOpen };
144
132
  }
@@ -2,8 +2,8 @@
2
2
  import { computed, ref, watch, useSlots, onMounted, type CSSProperties } from 'vue';
3
3
  import propsData from './props';
4
4
  import utils from '../../utils/utils';
5
- import useColor from '../../config/color';
6
- let color = useColor();
5
+ import { useColorStore } from '../../store/color';
6
+ let { getColor } = useColorStore();
7
7
 
8
8
  const slots = useSlots();
9
9
  const props = defineProps(propsData);
@@ -70,7 +70,7 @@ const cmpActiveStyle = computed(() => {
70
70
  if (props.disabled) {
71
71
  style.backgroundColor = '#cccccc';
72
72
  } else {
73
- const bg = utils.bg2style(props.activeBg ? props.activeBg : color.getColor().steThemeColor);
73
+ const bg = utils.bg2style(props.activeBg ? props.activeBg : getColor().steThemeColor);
74
74
  style = { ...style, ...bg };
75
75
  }
76
76
  return style;
@@ -1,6 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  import utils from '../../utils/utils';
3
- import { nextTick, onMounted, watch, defineOptions, getCurrentInstance, type ComponentPublicInstance } from 'vue';
3
+ import { nextTick, onMounted, watch, defineOptions, getCurrentInstance, ref, computed, type ComponentPublicInstance } from 'vue';
4
4
  import propsData from './props';
5
5
 
6
6
  import UQRCode, { type URCodeCanvasContext } from './uqrcode';
@@ -15,6 +15,16 @@ defineOptions({
15
15
  const instance = getCurrentInstance() as unknown as ComponentPublicInstance;
16
16
  const props = defineProps(propsData);
17
17
  const canvasId = 'ste-qrcode-' + utils.guid(8);
18
+ const canvasWidth = ref(props.size);
19
+ const canvasHeight = ref(props.size);
20
+
21
+ const compCanvasStyle = computed(() => {
22
+ return {
23
+ width: canvasWidth.value + 'px',
24
+ height: canvasHeight.value + 'px',
25
+ transform: `scale(${props.size / canvasWidth.value}, ${props.size / canvasHeight.value})`,
26
+ };
27
+ });
18
28
 
19
29
  onMounted(() => {
20
30
  initCanvas();
@@ -42,10 +52,6 @@ const initCanvas = () => {
42
52
  .select(`#${canvasId}`)
43
53
  .node(res => {
44
54
  const context = res.node.getContext('2d');
45
- const dpr = utils.System.getWindowInfo().pixelRatio;
46
- res.node.width = props.size * dpr;
47
- res.node.height = props.size * dpr;
48
- context.scale(dpr, dpr);
49
55
  draw(context, res.node);
50
56
  })
51
57
  .exec();
@@ -55,7 +61,26 @@ const initCanvas = () => {
55
61
 
56
62
  const draw = (ctx: URCodeCanvasContext, canvas: any = null) => {
57
63
  const qr = new UQRCode();
64
+ qr.useDynamicSize = true;
65
+
66
+ qr.backgroundColor = props.background;
67
+ qr.foregroundColor = props.foreground;
68
+ qr.foregroundImageSrc = props.foregroundImageSrc;
69
+ props.foregroundImageWidth ? (qr.foregroundImageWidth = props.foregroundImageWidth) : '';
70
+ props.foregroundImageHeight ? (qr.foregroundImageHeight = props.foregroundImageHeight) : '';
71
+ // 设置二维码内容
72
+ qr.data = props.content;
73
+ // 设置二维码大小,必须与canvas设置的宽高一致
74
+ qr.size = props.size;
75
+ // 调用制作二维码方法
76
+ qr.make();
77
+
58
78
  // #ifdef MP-WEIXIN || MP-ALIPAY
79
+ const context = canvas.getContext('2d');
80
+ const dpr = utils.System.getWindowInfo().pixelRatio;
81
+ canvas.width = qr.dynamicSize * dpr;
82
+ canvas.height = qr.dynamicSize * dpr;
83
+ context.scale(dpr, dpr);
59
84
  qr.loadImage = src => {
60
85
  // 需要返回Promise对象,小程序下获取网络图片信息需先配置download域名白名单才能生效
61
86
  return new Promise((resolve, reject) => {
@@ -75,6 +100,8 @@ const draw = (ctx: URCodeCanvasContext, canvas: any = null) => {
75
100
  // #endif
76
101
 
77
102
  // #ifdef H5
103
+ canvasWidth.value = qr.dynamicSize;
104
+ canvasHeight.value = qr.dynamicSize;
78
105
  qr.loadImage = src => {
79
106
  // 需要返回Promise对象
80
107
  return new Promise((resolve, reject) => {
@@ -93,42 +120,34 @@ const draw = (ctx: URCodeCanvasContext, canvas: any = null) => {
93
120
 
94
121
  // #endif
95
122
 
96
- qr.backgroundColor = props.background;
97
- qr.foregroundColor = props.foreground;
98
- qr.foregroundImageSrc = props.foregroundImageSrc;
99
- props.foregroundImageWidth ? (qr.foregroundImageWidth = props.foregroundImageWidth) : '';
100
- props.foregroundImageHeight ? (qr.foregroundImageHeight = props.foregroundImageHeight) : '';
101
- // 设置二维码内容
102
- qr.data = props.content;
103
- // 设置二维码大小,必须与canvas设置的宽高一致
104
- qr.size = props.size;
105
- // 调用制作二维码方法
106
- qr.make();
107
-
108
123
  // 设置uQRCode实例的canvas上下文
109
124
  qr.canvasContext = ctx;
110
125
  // 调用绘制方法将二维码图案绘制到canvas上
111
- qr.drawCanvas();
126
+ setTimeout(() => {
127
+ qr.drawCanvas().then(() => {});
128
+ }, 300);
112
129
  };
113
130
  </script>
114
131
 
115
132
  <template>
116
- <view class="ste-qrcode-root">
117
- <!-- #ifdef H5 || APP -->
118
- <canvas :style="{ width: size + 'px', height: size + 'px' }" :canvas-id="canvasId" :id="canvasId" class="h5-canvas"></canvas>
119
- <!-- #endif -->
120
-
121
- <!-- #ifdef MP-WEIXIN || MP-ALIPAY -->
122
- <canvas type="2d" :id="canvasId" :style="{ width: size + 'px', height: size + 'px' }" class="mp-canvas"></canvas>
123
- <!-- #endif -->
133
+ <view class="ste-qrcode-root" :style="{ width: `${size}px`, height: `${size}px` }">
134
+ <view class="canvas-wrapper">
135
+ <!-- #ifdef H5 || APP -->
136
+ <canvas :style="[compCanvasStyle]" :canvas-id="canvasId" :id="canvasId" class="h5-canvas"></canvas>
137
+ <!-- #endif -->
138
+
139
+ <!-- #ifdef MP-WEIXIN || MP-ALIPAY -->
140
+ <canvas type="2d" :id="canvasId" :style="[compCanvasStyle]" class="mp-canvas"></canvas>
141
+ <!-- #endif -->
142
+ </view>
124
143
  </view>
125
144
  </template>
126
145
 
127
146
  <style lang="scss" scoped>
128
- .ste-barcode-root {
129
- width: fit-content;
130
- display: flex;
131
- justify-content: center;
132
- align-items: center;
147
+ .ste-qrcode-root {
148
+ position: relative;
149
+ .h5-canvas {
150
+ transform-origin: top left;
151
+ }
133
152
  }
134
153
  </style>
@@ -1,7 +1,7 @@
1
1
  <script lang="ts" setup>
2
2
  import { useSlots, computed, type CSSProperties } from 'vue';
3
- import useColor from '../../config/color';
4
- let color = useColor();
3
+ import { useColorStore } from '../../store/color';
4
+ let { getColor } = useColorStore();
5
5
  import utils from '../../utils/utils';
6
6
  import propsData, { RADIO_KEY, type RadioEmits } from './props';
7
7
  import type { RadioGroupProps } from '../ste-radio-group/props';
@@ -24,7 +24,7 @@ const parentProps = computed(() => Parent?.parent?.props);
24
24
  const cmpReadonly = computed(() => getDefaultData('readonly', false));
25
25
  const cmpShape = computed(() => getDefaultData('shape', 'circle'));
26
26
  const cmpIconSize = computed(() => getDefaultData('iconSize', 36));
27
- const cmpCheckedColor = computed(() => getDefaultData('checkedColor', color.getColor().steThemeColor));
27
+ const cmpCheckedColor = computed(() => getDefaultData('checkedColor', getColor().steThemeColor));
28
28
  const cmpTextPosition = computed(() => getDefaultData('textPosition', 'right'));
29
29
  const cmpTextSize = computed(() => getDefaultData('textSize', 28));
30
30
  const cmpTextInactiveColor = computed(() => getDefaultData('textInactiveColor', '#000000'));
@@ -1,7 +1,7 @@
1
1
  <script setup lang="ts">
2
2
  import utils from '../../utils/utils.js';
3
- import useColor from '../../config/color';
4
- let color = useColor();
3
+ import { useColorStore } from '../../store/color';
4
+ let { getColor } = useColorStore();
5
5
  import propsData from './props';
6
6
  import { computed, defineOptions, type CSSProperties } from 'vue';
7
7
 
@@ -47,7 +47,7 @@ const cmpInactiveCode = computed(() => {
47
47
  });
48
48
 
49
49
  let cmpActiveColor = computed(() => {
50
- return props.activeColor ? props.activeColor : color.getColor().steThemeColor;
50
+ return props.activeColor ? props.activeColor : getColor().steThemeColor;
51
51
  });
52
52
 
53
53
  // 根据iconData来算出每个分值对应的iconCode