mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-05-23 15:09:16 +08:00
[improvement] Loading: tsx (#2765)
This commit is contained in:
parent
af0fb98c9e
commit
2e308ffc62
@ -1,10 +1,18 @@
|
|||||||
import { use } from '../utils';
|
import { use } from '../utils';
|
||||||
import { inherit } from '../utils/functional';
|
import { inherit } from '../utils/functional';
|
||||||
|
|
||||||
|
// Types
|
||||||
|
import { FunctionalComponent } from '../utils/use/sfc';
|
||||||
|
|
||||||
const [sfc, bem] = use('loading');
|
const [sfc, bem] = use('loading');
|
||||||
const DEFAULT_COLOR = '#c9c9c9';
|
const DEFAULT_COLOR = '#c9c9c9';
|
||||||
|
|
||||||
function Loading(h, props, slots, ctx) {
|
const Loading: FunctionalComponent<LoadingProps> = function(
|
||||||
|
h,
|
||||||
|
props,
|
||||||
|
slots,
|
||||||
|
ctx
|
||||||
|
) {
|
||||||
const { color, size, type } = props;
|
const { color, size, type } = props;
|
||||||
|
|
||||||
const colorType = color === 'white' || color === 'black' ? color : '';
|
const colorType = color === 'white' || color === 'black' ? color : '';
|
||||||
@ -36,7 +44,7 @@ function Loading(h, props, slots, ctx) {
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
Loading.props = {
|
Loading.props = {
|
||||||
size: String,
|
size: String,
|
||||||
@ -50,4 +58,10 @@ Loading.props = {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default sfc(Loading);
|
export type LoadingProps = {
|
||||||
|
size?: string;
|
||||||
|
type?: string;
|
||||||
|
color?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default sfc<LoadingProps>(Loading);
|
Loading…
x
Reference in New Issue
Block a user