|
@@ -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<CSSProperties>
|
|
|
}
|
|
|
-
|
|
|
-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 }
|