perf: propTypes
This commit is contained in:
parent
1a1b70a350
commit
5da9b660bd
@ -1,12 +1,10 @@
|
|||||||
import { createTypes, VueTypesInterface, VueTypeValidableDef } from 'vue-types'
|
import { VueTypeValidableDef, VueTypesInterface, createTypes, toValidableType } from 'vue-types'
|
||||||
import { CSSProperties } from 'vue'
|
import { CSSProperties } from 'vue'
|
||||||
|
|
||||||
// 自定义扩展vue-types
|
|
||||||
type PropTypes = VueTypesInterface & {
|
type PropTypes = VueTypesInterface & {
|
||||||
readonly style: VueTypeValidableDef<CSSProperties>
|
readonly style: VueTypeValidableDef<CSSProperties>
|
||||||
}
|
}
|
||||||
|
const newPropTypes = createTypes({
|
||||||
const propTypes = createTypes({
|
|
||||||
func: undefined,
|
func: undefined,
|
||||||
bool: undefined,
|
bool: undefined,
|
||||||
string: undefined,
|
string: undefined,
|
||||||
@ -15,14 +13,12 @@ const propTypes = createTypes({
|
|||||||
integer: undefined
|
integer: undefined
|
||||||
}) as PropTypes
|
}) as PropTypes
|
||||||
|
|
||||||
// 需要自定义扩展的类型
|
class propTypes extends newPropTypes {
|
||||||
// see: https://dwightjack.github.io/vue-types/advanced/extending-vue-types.html#the-extend-method
|
static get style() {
|
||||||
// propTypes.extend([
|
return toValidableType('style', {
|
||||||
// {
|
type: [String, Object]
|
||||||
// name: 'style',
|
})
|
||||||
// getter: true,
|
}
|
||||||
// type: [String, Object],
|
}
|
||||||
// default: undefined
|
|
||||||
// }
|
|
||||||
// ])
|
|
||||||
export { propTypes }
|
export { propTypes }
|
||||||
|
Loading…
Reference in New Issue
Block a user