@vrojs/base 0.0.1 → 0.0.2
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/dist/index.d.ts +6 -0
- package/dist/index.js +35 -0
- package/dist/style/css.js +4 -0
- package/dist/style/index.css +1 -0
- package/dist/style/index.d.ts +0 -0
- package/dist/style/index.js +4 -0
- package/dist/types/Arrayable.d.ts +1 -0
- package/dist/types/Arrayable.js +1 -0
- package/dist/types/DeepPartial.d.ts +3 -0
- package/dist/types/DeepPartial.js +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.js +1 -0
- package/dist/utils/ComponentManager.d.ts +18 -0
- package/dist/utils/ComponentManager.js +21 -0
- package/dist/utils/format.d.ts +5 -0
- package/dist/utils/format.js +14 -0
- package/dist/utils/index.d.ts +8 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/mountComponent.d.ts +5 -0
- package/dist/utils/mountComponent.js +12 -0
- package/dist/utils/parseType.d.ts +1 -0
- package/dist/utils/parseType.js +4 -0
- package/dist/utils/props.d.ts +2 -0
- package/dist/utils/props.js +5 -0
- package/dist/utils/renderComponent.d.ts +5 -0
- package/dist/utils/renderComponent.js +17 -0
- package/dist/utils/showComponent.d.ts +6 -0
- package/dist/utils/showComponent.js +17 -0
- package/dist/utils/withInstall.d.ts +3 -0
- package/dist/utils/withInstall.js +6 -0
- package/dist/vro-aspect-ratio/index.d.ts +46 -0
- package/dist/vro-aspect-ratio/index.js +11 -0
- package/dist/vro-aspect-ratio/style/css.d.ts +0 -0
- package/dist/vro-aspect-ratio/style/css.js +4 -0
- package/dist/vro-aspect-ratio/style/index.css +1 -0
- package/dist/vro-aspect-ratio/style/index.d.ts +0 -0
- package/dist/vro-aspect-ratio/style/index.js +4 -0
- package/dist/vro-aspect-ratio/types.d.ts +13 -0
- package/dist/vro-aspect-ratio/types.js +14 -0
- package/dist/vro-aspect-ratio/vro-aspect-ratio.vue.d.ts +29 -0
- package/dist/vro-aspect-ratio/vro-aspect-ratio.vue.js +25 -0
- package/dist/vro-aspect-ratio/vro-aspect-ratio.vue2.js +4 -0
- package/dist/vro-input/index.d.ts +90 -0
- package/dist/vro-input/index.js +11 -0
- package/dist/vro-input/style/css.d.ts +0 -0
- package/dist/vro-input/style/css.js +3 -0
- package/dist/vro-input/style/index.d.ts +0 -0
- package/dist/vro-input/style/index.js +3 -0
- package/dist/vro-input/types.d.ts +95 -0
- package/{src/vro-input/types.ts → dist/vro-input/types.js} +17 -30
- package/dist/vro-input/vro-input.vue.d.ts +83 -0
- package/dist/vro-input/vro-input.vue.js +62 -0
- package/dist/vro-input/vro-input.vue2.js +4 -0
- package/dist/vro-loading/index.d.ts +91 -0
- package/dist/vro-loading/index.js +11 -0
- package/dist/vro-loading/style/css.d.ts +0 -0
- package/dist/vro-loading/style/css.js +4 -0
- package/dist/vro-loading/style/index.css +1 -0
- package/dist/vro-loading/style/index.d.ts +0 -0
- package/dist/vro-loading/style/index.js +4 -0
- package/dist/vro-loading/types.d.ts +33 -0
- package/dist/vro-loading/types.js +33 -0
- package/dist/vro-loading/vro-loading.vue.d.ts +56 -0
- package/dist/vro-loading/vro-loading.vue.js +50 -0
- package/dist/vro-loading/vro-loading.vue2.js +4 -0
- package/dist/vro-vnr/index.d.ts +25 -0
- package/dist/vro-vnr/index.js +11 -0
- package/dist/vro-vnr/style/css.d.ts +0 -0
- package/dist/vro-vnr/style/css.js +3 -0
- package/dist/vro-vnr/style/index.d.ts +0 -0
- package/dist/vro-vnr/style/index.js +3 -0
- package/dist/vro-vnr/types.d.ts +8 -0
- package/dist/vro-vnr/types.js +9 -0
- package/dist/vro-vnr/vro-vnr.vue.d.ts +18 -0
- package/dist/vro-vnr/vro-vnr.vue.js +12 -0
- package/dist/vro-vnr/vro-vnr.vue2.js +4 -0
- package/package.json +16 -10
- package/src/index.ts +0 -8
- package/src/style/base.scss +0 -2
- package/src/style/css.ts +0 -2
- package/src/style/index.scss +0 -7
- package/src/style/index.ts +0 -1
- package/src/types/Arrayable.ts +0 -1
- package/src/types/DeepPartial.ts +0 -3
- package/src/types/index.ts +0 -2
- package/src/utils/ComponentManager.ts +0 -39
- package/src/utils/format.ts +0 -31
- package/src/utils/index.ts +0 -8
- package/src/utils/mountComponent.ts +0 -16
- package/src/utils/parseType.ts +0 -6
- package/src/utils/props.ts +0 -3
- package/src/utils/renderComponent.ts +0 -24
- package/src/utils/showComponent.ts +0 -24
- package/src/utils/withInstall.ts +0 -10
- package/src/vro-aspect-ratio/README.md +0 -55
- package/src/vro-aspect-ratio/index.ts +0 -15
- package/src/vro-aspect-ratio/style/css.ts +0 -2
- package/src/vro-aspect-ratio/style/index.scss +0 -16
- package/src/vro-aspect-ratio/style/index.ts +0 -1
- package/src/vro-aspect-ratio/types.ts +0 -15
- package/src/vro-aspect-ratio/vro-aspect-ratio.vue +0 -23
- package/src/vro-input/README.md +0 -95
- package/src/vro-input/index.ts +0 -15
- package/src/vro-input/style/css.ts +0 -2
- package/src/vro-input/style/index.ts +0 -1
- package/src/vro-input/vro-input.vue +0 -122
- package/src/vro-loading/README.md +0 -77
- package/src/vro-loading/index.ts +0 -15
- package/src/vro-loading/style/css.ts +0 -2
- package/src/vro-loading/style/index.scss +0 -119
- package/src/vro-loading/style/index.ts +0 -1
- package/src/vro-loading/types.ts +0 -39
- package/src/vro-loading/vro-loading.vue +0 -39
- package/src/vro-vnr/README.md +0 -46
- package/src/vro-vnr/index.ts +0 -15
- package/src/vro-vnr/style/css.ts +0 -2
- package/src/vro-vnr/style/index.ts +0 -1
- package/src/vro-vnr/types.ts +0 -10
- package/src/vro-vnr/vro-vnr.vue +0 -13
- /package/{src/vro-input/style/index.scss → dist/style/base.css} +0 -0
- /package/{src/vro-vnr/style/index.scss → dist/style/css.d.ts} +0 -0
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<input
|
|
3
|
-
v-bind="dynamicProps"
|
|
4
|
-
class="vro-input"
|
|
5
|
-
ref="inputRef"
|
|
6
|
-
:value="modelValue ?? ''"
|
|
7
|
-
@compositionstart="handleCompositionStart"
|
|
8
|
-
@compositionend="handleCompositionEnd"
|
|
9
|
-
@input="handleInput"
|
|
10
|
-
@blur="handleBlur"
|
|
11
|
-
/>
|
|
12
|
-
</template>
|
|
13
|
-
|
|
14
|
-
<script setup lang="ts">
|
|
15
|
-
import { isNumber, omit } from '@daysnap/utils'
|
|
16
|
-
import { useComposition, useId } from '@vrojs/use'
|
|
17
|
-
import { computed, ref } from 'vue'
|
|
18
|
-
|
|
19
|
-
import { parseDecimalString, parseNumberString } from '../utils'
|
|
20
|
-
import { vroInputProps } from './types'
|
|
21
|
-
|
|
22
|
-
defineOptions({ name: 'VroInput' })
|
|
23
|
-
const props = defineProps(vroInputProps)
|
|
24
|
-
const emit = defineEmits<{
|
|
25
|
-
(event: 'update:modelValue', value: string): void
|
|
26
|
-
(event: 'blur', value: FocusEvent): void
|
|
27
|
-
(event: 'input', value: InputEvent): void
|
|
28
|
-
}>()
|
|
29
|
-
|
|
30
|
-
const inputRef = ref<HTMLInputElement>()
|
|
31
|
-
const fallbackId = useId()
|
|
32
|
-
|
|
33
|
-
const dynamicProps = computed(() => {
|
|
34
|
-
// eslint-disable-next-line prefer-const
|
|
35
|
-
let { type, inputmode, ...rest } = props
|
|
36
|
-
|
|
37
|
-
if (type === 'decimal') {
|
|
38
|
-
type = 'text'
|
|
39
|
-
inputmode = 'decimal'
|
|
40
|
-
} else if (type === 'number') {
|
|
41
|
-
type = 'tel'
|
|
42
|
-
inputmode = 'numeric'
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
return {
|
|
46
|
-
...omit(rest, ['autoFix', 'formatter', 'modelValue', 'precision', 'max', 'min']),
|
|
47
|
-
id: props.id ?? fallbackId,
|
|
48
|
-
type,
|
|
49
|
-
inputmode,
|
|
50
|
-
}
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
const { handleCompositionStart, handleCompositionEnd } = useComposition()
|
|
54
|
-
|
|
55
|
-
const handleBlur = (event: FocusEvent) => {
|
|
56
|
-
const { type, modelValue } = props
|
|
57
|
-
if (type === 'decimal') {
|
|
58
|
-
const v = modelValue?.toString() ?? ''
|
|
59
|
-
if (v === '-') {
|
|
60
|
-
// 修复只输入 - 的情况
|
|
61
|
-
emit('update:modelValue', '')
|
|
62
|
-
} else if (v.endsWith('.')) {
|
|
63
|
-
// 修复末尾只输入.的情况
|
|
64
|
-
emit('update:modelValue', v.substring(0, v.length - 1))
|
|
65
|
-
} else if (v !== '' && +v === 0) {
|
|
66
|
-
// 修复 -0、-0.0 这种情况
|
|
67
|
-
emit('update:modelValue', '0')
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
emit('blur', event)
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
const handleInput = (e: InputEvent) => {
|
|
74
|
-
const target = e.target as HTMLInputElement
|
|
75
|
-
if ((target as any)?.composing) {
|
|
76
|
-
return
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
const { type, precision, min, max, formatter, modelValue, autoFix } = props
|
|
80
|
-
let value = target.value
|
|
81
|
-
|
|
82
|
-
if (type === 'number') {
|
|
83
|
-
value = parseNumberString(value)
|
|
84
|
-
} else if (type === 'decimal') {
|
|
85
|
-
value = parseDecimalString(value, { precision: +precision, allowNegativeNumber: +min < 0 })
|
|
86
|
-
|
|
87
|
-
const valueNumber = Number(value)
|
|
88
|
-
const minNumber = Number(min)
|
|
89
|
-
const maxNumber = Number(max)
|
|
90
|
-
const canCompare = value !== '' && value !== '-' && Number.isFinite(valueNumber)
|
|
91
|
-
|
|
92
|
-
if (canCompare && (valueNumber < minNumber || valueNumber > maxNumber)) {
|
|
93
|
-
if (autoFix) {
|
|
94
|
-
if (valueNumber < minNumber) {
|
|
95
|
-
value = min.toString()
|
|
96
|
-
} else if (valueNumber > maxNumber) {
|
|
97
|
-
value = max.toString()
|
|
98
|
-
}
|
|
99
|
-
} else {
|
|
100
|
-
value = modelValue?.toString() ?? ''
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
if (formatter) {
|
|
106
|
-
value = formatter(value, isNumber(modelValue) ? modelValue.toString() : (modelValue ?? ''))
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
if (target.value !== value) {
|
|
110
|
-
target.value = value
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
emit('update:modelValue', value)
|
|
114
|
-
emit('input', e)
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
defineExpose({
|
|
118
|
-
get input() {
|
|
119
|
-
return inputRef.value!
|
|
120
|
-
},
|
|
121
|
-
})
|
|
122
|
-
</script>
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
# VroLoading
|
|
2
|
-
|
|
3
|
-
### 介绍
|
|
4
|
-
|
|
5
|
-
纯 Vue/CSS 的加载图标,不依赖第三方库。支持圆环、线圈、点状三种形态,可配置尺寸和颜色。
|
|
6
|
-
|
|
7
|
-
## 代码演示
|
|
8
|
-
|
|
9
|
-
### 基础用法
|
|
10
|
-
|
|
11
|
-
```html
|
|
12
|
-
<vro-loading />
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
### 加载类型
|
|
16
|
-
|
|
17
|
-
```html
|
|
18
|
-
<vro-loading type="circular" />
|
|
19
|
-
<vro-loading type="spinner" />
|
|
20
|
-
<vro-loading type="dots" />
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### 自定义样式
|
|
24
|
-
|
|
25
|
-
```html
|
|
26
|
-
<vro-loading type="spinner" color="#409eff" :size="40" />
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
### 自定义图标
|
|
30
|
-
|
|
31
|
-
```html
|
|
32
|
-
<vro-loading>
|
|
33
|
-
<template #icon>
|
|
34
|
-
<span class="custom-loading-icon"></span>
|
|
35
|
-
</template>
|
|
36
|
-
</vro-loading>
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## API
|
|
40
|
-
|
|
41
|
-
### 属性 Props
|
|
42
|
-
|
|
43
|
-
<table>
|
|
44
|
-
<tbody>
|
|
45
|
-
<tr>
|
|
46
|
-
<td>名称</td>
|
|
47
|
-
<td>类型</td>
|
|
48
|
-
<td>默认值</td>
|
|
49
|
-
</tr>
|
|
50
|
-
<tr v-for="(item, key) in vroLoadingProps" :key="key">
|
|
51
|
-
<td>{{ key }}</td>
|
|
52
|
-
<td>{{ parseType(item.type || item) }}</td>
|
|
53
|
-
<td>{{ reserve(item.default, '-') }}</td>
|
|
54
|
-
</tr>
|
|
55
|
-
</tbody>
|
|
56
|
-
</table>
|
|
57
|
-
|
|
58
|
-
### 插槽 Slots
|
|
59
|
-
|
|
60
|
-
<table>
|
|
61
|
-
<tbody>
|
|
62
|
-
<tr>
|
|
63
|
-
<td>名称</td>
|
|
64
|
-
<td>说明</td>
|
|
65
|
-
</tr>
|
|
66
|
-
<tr>
|
|
67
|
-
<td>icon</td>
|
|
68
|
-
<td>自定义加载图标</td>
|
|
69
|
-
</tr>
|
|
70
|
-
</tbody>
|
|
71
|
-
</table>
|
|
72
|
-
|
|
73
|
-
<script setup lang="ts">
|
|
74
|
-
import { reserve } from '@daysnap/utils'
|
|
75
|
-
import { VroLoading, vroLoadingProps } from '.'
|
|
76
|
-
import { parseType } from '../utils'
|
|
77
|
-
</script>
|
package/src/vro-loading/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { withInstall } from '../utils'
|
|
2
|
-
import Component from './vro-loading.vue'
|
|
3
|
-
|
|
4
|
-
export * from './types'
|
|
5
|
-
|
|
6
|
-
export const VroLoading = withInstall<typeof Component>(Component)
|
|
7
|
-
export default VroLoading
|
|
8
|
-
|
|
9
|
-
export type VroLoadingInstance = InstanceType<typeof VroLoading>
|
|
10
|
-
|
|
11
|
-
declare module 'vue' {
|
|
12
|
-
export interface GlobalComponents {
|
|
13
|
-
VroLoading: typeof VroLoading
|
|
14
|
-
}
|
|
15
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
.vro-loading {
|
|
2
|
-
--vro-loading-size: 32px;
|
|
3
|
-
--vro-loading-color: currentColor;
|
|
4
|
-
|
|
5
|
-
display: inline-flex;
|
|
6
|
-
align-items: center;
|
|
7
|
-
justify-content: center;
|
|
8
|
-
color: var(--vro-loading-color);
|
|
9
|
-
line-height: 1;
|
|
10
|
-
vertical-align: middle;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
.vro-loading__circular {
|
|
14
|
-
width: var(--vro-loading-size);
|
|
15
|
-
height: var(--vro-loading-size);
|
|
16
|
-
animation: vro-loading-rotate 1.6s linear infinite;
|
|
17
|
-
|
|
18
|
-
circle {
|
|
19
|
-
stroke: currentColor;
|
|
20
|
-
stroke-width: 4;
|
|
21
|
-
stroke-linecap: round;
|
|
22
|
-
stroke-dasharray: 90, 150;
|
|
23
|
-
stroke-dashoffset: 0;
|
|
24
|
-
animation: vro-loading-circular 1.6s ease-in-out infinite;
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.vro-loading__spinner {
|
|
29
|
-
position: relative;
|
|
30
|
-
width: var(--vro-loading-size);
|
|
31
|
-
height: var(--vro-loading-size);
|
|
32
|
-
animation: vro-loading-fade 1.2s linear infinite;
|
|
33
|
-
|
|
34
|
-
i {
|
|
35
|
-
position: absolute;
|
|
36
|
-
left: 50%;
|
|
37
|
-
top: 0;
|
|
38
|
-
width: 2px;
|
|
39
|
-
height: 28%;
|
|
40
|
-
background: currentColor;
|
|
41
|
-
border-radius: 999px;
|
|
42
|
-
transform-origin: center calc(var(--vro-loading-size) / 2);
|
|
43
|
-
|
|
44
|
-
@for $i from 1 through 12 {
|
|
45
|
-
&:nth-child(#{$i}) {
|
|
46
|
-
opacity: calc(#{$i} / 12);
|
|
47
|
-
transform: translateX(-50%) rotate(#{($i - 1) * 30deg});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.vro-loading__dots {
|
|
54
|
-
display: inline-flex;
|
|
55
|
-
align-items: center;
|
|
56
|
-
justify-content: center;
|
|
57
|
-
gap: calc(var(--vro-loading-size) * 0.12);
|
|
58
|
-
width: var(--vro-loading-size);
|
|
59
|
-
height: var(--vro-loading-size);
|
|
60
|
-
|
|
61
|
-
i {
|
|
62
|
-
width: calc(var(--vro-loading-size) * 0.18);
|
|
63
|
-
height: calc(var(--vro-loading-size) * 0.18);
|
|
64
|
-
background: currentColor;
|
|
65
|
-
border-radius: 50%;
|
|
66
|
-
animation: vro-loading-dot 1s ease-in-out infinite;
|
|
67
|
-
|
|
68
|
-
&:nth-child(2) {
|
|
69
|
-
animation-delay: 0.15s;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
&:nth-child(3) {
|
|
73
|
-
animation-delay: 0.3s;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
@keyframes vro-loading-rotate {
|
|
79
|
-
100% {
|
|
80
|
-
transform: rotate(360deg);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
@keyframes vro-loading-circular {
|
|
85
|
-
0% {
|
|
86
|
-
stroke-dasharray: 1, 200;
|
|
87
|
-
stroke-dashoffset: 0;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
50% {
|
|
91
|
-
stroke-dasharray: 90, 150;
|
|
92
|
-
stroke-dashoffset: -40;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
100% {
|
|
96
|
-
stroke-dasharray: 90, 150;
|
|
97
|
-
stroke-dashoffset: -120;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
@keyframes vro-loading-fade {
|
|
102
|
-
100% {
|
|
103
|
-
transform: rotate(360deg);
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
@keyframes vro-loading-dot {
|
|
108
|
-
0%,
|
|
109
|
-
80%,
|
|
110
|
-
100% {
|
|
111
|
-
opacity: 0.35;
|
|
112
|
-
transform: scale(0.72);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
40% {
|
|
116
|
-
opacity: 1;
|
|
117
|
-
transform: scale(1);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './css'
|
package/src/vro-loading/types.ts
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { ExtractPropTypes, PropType } from 'vue'
|
|
2
|
-
|
|
3
|
-
export type VroLoadingType = 'circular' | 'spinner' | 'dots'
|
|
4
|
-
|
|
5
|
-
export const vroLoadingProps = {
|
|
6
|
-
/**
|
|
7
|
-
* 加载图标类型。
|
|
8
|
-
*/
|
|
9
|
-
type: {
|
|
10
|
-
type: String as PropType<VroLoadingType>,
|
|
11
|
-
default: 'circular',
|
|
12
|
-
},
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* 加载图标尺寸,传入数字时单位为 px。
|
|
16
|
-
*/
|
|
17
|
-
size: {
|
|
18
|
-
type: [String, Number] as PropType<string | number>,
|
|
19
|
-
default: 24,
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* 加载图标颜色。
|
|
24
|
-
*/
|
|
25
|
-
color: {
|
|
26
|
-
type: String,
|
|
27
|
-
default: 'currentColor',
|
|
28
|
-
},
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* 无障碍标签。
|
|
32
|
-
*/
|
|
33
|
-
ariaLabel: {
|
|
34
|
-
type: String,
|
|
35
|
-
default: '加载中',
|
|
36
|
-
},
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export type VroLoadingProps = ExtractPropTypes<typeof vroLoadingProps>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<div class="vro-loading" :style="loadingStyle" role="status" :aria-label="ariaLabel">
|
|
3
|
-
<slot name="icon">
|
|
4
|
-
<span v-if="type === 'spinner'" class="vro-loading__spinner" aria-hidden="true">
|
|
5
|
-
<i v-for="item in 12" :key="item"></i>
|
|
6
|
-
</span>
|
|
7
|
-
|
|
8
|
-
<span v-else-if="type === 'dots'" class="vro-loading__dots" aria-hidden="true">
|
|
9
|
-
<i v-for="item in 3" :key="item"></i>
|
|
10
|
-
</span>
|
|
11
|
-
|
|
12
|
-
<svg v-else class="vro-loading__circular" viewBox="0 0 50 50" aria-hidden="true">
|
|
13
|
-
<circle cx="25" cy="25" r="20" fill="none"></circle>
|
|
14
|
-
</svg>
|
|
15
|
-
</slot>
|
|
16
|
-
</div>
|
|
17
|
-
</template>
|
|
18
|
-
|
|
19
|
-
<script setup lang="ts">
|
|
20
|
-
import { computed } from 'vue'
|
|
21
|
-
|
|
22
|
-
import { vroLoadingProps } from './types'
|
|
23
|
-
|
|
24
|
-
defineOptions({ name: 'VroLoading' })
|
|
25
|
-
|
|
26
|
-
const props = defineProps(vroLoadingProps)
|
|
27
|
-
|
|
28
|
-
const addUnit = (value?: string | number) => {
|
|
29
|
-
if (typeof value === 'number') {
|
|
30
|
-
return `${value}px`
|
|
31
|
-
}
|
|
32
|
-
return value || undefined
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const loadingStyle = computed(() => ({
|
|
36
|
-
'--vro-loading-size': addUnit(props.size),
|
|
37
|
-
'--vro-loading-color': props.color,
|
|
38
|
-
}))
|
|
39
|
-
</script>
|
package/src/vro-vnr/README.md
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
# VroVnr
|
|
2
|
-
|
|
3
|
-
### 介绍
|
|
4
|
-
|
|
5
|
-
用于渲染由 `h`、`render` 函数或其他逻辑生成的 VNode 数组。
|
|
6
|
-
|
|
7
|
-
## 代码演示
|
|
8
|
-
|
|
9
|
-
### 基础用法
|
|
10
|
-
|
|
11
|
-
```html
|
|
12
|
-
<template>
|
|
13
|
-
<vro-vnr :nodes="nodes" />
|
|
14
|
-
</template>
|
|
15
|
-
|
|
16
|
-
<script setup lang="ts">
|
|
17
|
-
import { h } from 'vue'
|
|
18
|
-
|
|
19
|
-
const nodes = [h('span', '文本'), h('button', { type: 'button' }, '按钮')]
|
|
20
|
-
</script>
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## API
|
|
24
|
-
|
|
25
|
-
### 属性 Props
|
|
26
|
-
|
|
27
|
-
<table>
|
|
28
|
-
<tbody>
|
|
29
|
-
<tr>
|
|
30
|
-
<td>名称</td>
|
|
31
|
-
<td>类型</td>
|
|
32
|
-
<td>默认值</td>
|
|
33
|
-
</tr>
|
|
34
|
-
<tr v-for="(item, key) in vroVnrProps" :key="key">
|
|
35
|
-
<td>{{ key }}</td>
|
|
36
|
-
<td>{{ parseType(item.type || item) }}</td>
|
|
37
|
-
<td>{{ reserve(item.default, '-') }}</td>
|
|
38
|
-
</tr>
|
|
39
|
-
</tbody>
|
|
40
|
-
</table>
|
|
41
|
-
|
|
42
|
-
<script setup lang="ts">
|
|
43
|
-
import { reserve } from '@daysnap/utils'
|
|
44
|
-
import { VroVnr, vroVnrProps } from '.'
|
|
45
|
-
import { parseType } from '../utils'
|
|
46
|
-
</script>
|
package/src/vro-vnr/index.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { withInstall } from '../utils'
|
|
2
|
-
import Component from './vro-vnr.vue'
|
|
3
|
-
|
|
4
|
-
export * from './types'
|
|
5
|
-
|
|
6
|
-
export const VroVnr = withInstall<typeof Component>(Component)
|
|
7
|
-
export default VroVnr
|
|
8
|
-
|
|
9
|
-
export type VroVnrInstance = InstanceType<typeof VroVnr>
|
|
10
|
-
|
|
11
|
-
declare module 'vue' {
|
|
12
|
-
export interface GlobalComponents {
|
|
13
|
-
VroVnr: typeof VroVnr
|
|
14
|
-
}
|
|
15
|
-
}
|
package/src/vro-vnr/style/css.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import './css'
|
package/src/vro-vnr/types.ts
DELETED
package/src/vro-vnr/vro-vnr.vue
DELETED
|
File without changes
|
|
File without changes
|