types(SubmitBar): use tsx (#8081)

This commit is contained in:
neverland 2021-02-04 16:36:57 +08:00 committed by GitHub
parent aeeeae8d2b
commit c0c2e8e125
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,9 @@
import { PropType, CSSProperties } from 'vue';
import { createNamespace } from '../utils'; import { createNamespace } from '../utils';
// Components
import Icon from '../icon'; import Icon from '../icon';
import Button from '../button'; import Button, { ButtonType } from '../button';
const [createComponent, bem, t] = createNamespace('submit-bar'); const [createComponent, bem, t] = createNamespace('submit-bar');
@ -12,7 +15,7 @@ export default createComponent({
tipIcon: String, tipIcon: String,
loading: Boolean, loading: Boolean,
disabled: Boolean, disabled: Boolean,
textAlign: String, textAlign: String as PropType<CSSProperties['textAlign']>,
buttonText: String, buttonText: String,
buttonColor: String, buttonColor: String,
suffixLabel: String, suffixLabel: String,
@ -29,7 +32,7 @@ export default createComponent({
default: '¥', default: '¥',
}, },
buttonType: { buttonType: {
type: String, type: String as PropType<ButtonType>,
default: 'danger', default: 'danger',
}, },
}, },
@ -48,7 +51,7 @@ export default createComponent({
} = props; } = props;
if (typeof price === 'number') { if (typeof price === 'number') {
const pricePair = (price / 100).toFixed(decimalLength).split('.'); const pricePair = (price / 100).toFixed(+decimalLength).split('.');
const decimal = decimalLength ? `.${pricePair[1]}` : ''; const decimal = decimalLength ? `.${pricePair[1]}` : '';
return ( return (