diff --git a/src/utils/propTypes.ts b/src/utils/propTypes.ts index fb8f84e7..863f55cc 100644 --- a/src/utils/propTypes.ts +++ b/src/utils/propTypes.ts @@ -1,12 +1,10 @@ -import { createTypes, VueTypesInterface, VueTypeValidableDef } from 'vue-types' +import { VueTypeValidableDef, VueTypesInterface, createTypes, toValidableType } from 'vue-types' import { CSSProperties } from 'vue' -// 自定义扩展vue-types type PropTypes = VueTypesInterface & { readonly style: VueTypeValidableDef } - -const propTypes = createTypes({ +const newPropTypes = createTypes({ func: undefined, bool: undefined, string: undefined, @@ -15,14 +13,12 @@ const propTypes = createTypes({ integer: undefined }) as PropTypes -// 需要自定义扩展的类型 -// see: https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method -// propTypes.extend([ -// { -// name: 'style', -// getter: true, -// type: [String, Object], -// default: undefined -// } -// ]) +class propTypes extends newPropTypes { + static get style() { + return toValidableType('style', { + type: [String, Object] + }) + } +} + export { propTypes }