Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
admin
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5da9b660
authored
Oct 16, 2023
by
xingyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: propTypes
parent
1a1b70a3
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
14 deletions
+10
-14
src/utils/propTypes.ts
+10
-14
No files found.
src/utils/propTypes.ts
View file @
5da9b660
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
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment