优化props解析
parent
db7098c4f8
commit
c56013c9b4
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "wkit",
|
||||
"version": "1.11.3",
|
||||
"version": "1.11.4",
|
||||
"type": "module",
|
||||
"description": "A library for building fast, lightweight web components.",
|
||||
"main": "dist/index.js",
|
||||
|
|
|
@ -83,16 +83,14 @@ function getType(v) {
|
|||
let type = String
|
||||
let attribute = true
|
||||
if (v.includes('!')) {
|
||||
v = v.split('!')
|
||||
let _t = v.shift()
|
||||
if (_t === 'str') {
|
||||
v = v.join('!')
|
||||
} else if (_t === 'num') {
|
||||
if (v.startsWith('str!')) {
|
||||
v = v.slice(4)
|
||||
} else if (v.startsWith('num!')) {
|
||||
type = Number
|
||||
v = +v.shift() || 0
|
||||
} else if (_t === 'bool') {
|
||||
v = +v.slice(4) || 0
|
||||
} else if (v.startsWith('bool!')) {
|
||||
type = Boolean
|
||||
v = v.shift()
|
||||
v = v.slice(5)
|
||||
v = v !== 'false' && v !== ''
|
||||
}
|
||||
attribute = false
|
||||
|
|
Loading…
Reference in New Issue