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