- 测试
-
- 测试
- 测试
- 测试
- 测试
-
- 测试
- 测试
- 测试
- 测试
-
- 测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试
- 测试
-
切换状态
{{ disabled ? '禁用' : '启用' }}
+
+ Large
+
+
+ Normal
+
+
+ Small
+
+
+ Mini
+
+
+
+ Large
+
+
+ Normal
+
+
+ Small
+
+
+ Mini
+
+
+
+ Large
+
+
+ Normal
+
+
+ Small
+
+
+ Mini
+
+
- 给老子转!
+ Large
+
+
+ Normal
+
+
+ Small
+
+
+ Mini
diff --git a/packages/varlet-ui/src/button/propsEmits.ts b/packages/varlet-ui/src/button/propsEmits.ts
index dd09a5cdc29..02962924cb5 100644
--- a/packages/varlet-ui/src/button/propsEmits.ts
+++ b/packages/varlet-ui/src/button/propsEmits.ts
@@ -1,3 +1,9 @@
+import {
+ typeValidator as loadingTypeValidator,
+ sizeValidator as loadingSizeValidator,
+ getTypeDefault as getLoadingTypeDefault
+} from '../loading/propsEmits'
+
function typeValidator(type: string): boolean {
const validTypes = ['plain', 'primary', 'info', 'success', 'warning', 'danger']
@@ -28,6 +34,18 @@ export const props = {
type: Boolean,
default: false
},
+ // 加载动画类型
+ loadingType: {
+ type: String,
+ default: getLoadingTypeDefault,
+ validator: loadingTypeValidator
+ },
+ // 加载动画尺寸
+ loadingSize: {
+ type: String,
+ default: (props: any) => props.size,
+ validator: loadingSizeValidator
+ },
// 原型按钮
round: {
type: Boolean,
diff --git a/packages/varlet-ui/src/loading/propsEmits.ts b/packages/varlet-ui/src/loading/propsEmits.ts
index d75166c1961..85e91629bff 100644
--- a/packages/varlet-ui/src/loading/propsEmits.ts
+++ b/packages/varlet-ui/src/loading/propsEmits.ts
@@ -1,25 +1,29 @@
-function typeValidator(type: string): boolean {
+export function typeValidator(type: string): boolean {
const validTypes = ['wave', 'cube', 'rect', 'disappear']
return validTypes.includes(type)
}
-function sizeValidator(size: string): boolean {
+export function sizeValidator(size: string): boolean {
const validSizes = ['normal', 'mini', 'small', 'large']
return validSizes.includes(size)
}
+export const getTypeDefault = () => 'wave'
+
+export const getSizeDefault = () => 'normal'
+
export const props = {
// loading类型
type: {
type: String,
- default: 'wave',
+ default: getTypeDefault,
validator: typeValidator,
},
// loading尺寸
size: {
type: String,
- default: 'normal',
+ default: getSizeDefault,
validator: sizeValidator,
},
// loading颜色