diff --git a/build.dev.js b/build.dev.js
index 6eca096..4a90832 100644
--- a/build.dev.js
+++ b/build.dev.js
@@ -112,7 +112,10 @@ function mkWCFile({ style, html, js }) {
)
.replace('mounted()', 'connectedCallback()')
.replace('unmount()', 'disconnectedCallback()')
- .replace(/watch\(([\w\s,]*?)\)/, 'attributeChangedCallback($1)')
+ .replace(
+ 'watch() {',
+ 'attributeChangedCallback(name, old, val) {\nif (old === val) {return}'
+ )
.replace('adopted()', 'adoptedCallback()')
return `/**
diff --git a/build.prod.js b/build.prod.js
index eafd74c..4d2a8da 100644
--- a/build.prod.js
+++ b/build.prod.js
@@ -119,7 +119,10 @@ function mkWCFile({ style, html, js }) {
)
.replace('mounted()', 'connectedCallback()')
.replace('unmount()', 'disconnectedCallback()')
- .replace(/watch\(([\w\s,]*?)\)/, 'attributeChangedCallback($1)')
+ .replace(
+ 'watch() {',
+ 'attributeChangedCallback(name, old, val) {\nif (old === val) {return}'
+ )
.replace('adopted()', 'adoptedCallback()')
let res = uglify.minify(js)
diff --git a/src/avatar/index.wc b/src/avatar/index.wc
index 59100cc..8553d0c 100644
--- a/src/avatar/index.wc
+++ b/src/avatar/index.wc
@@ -176,10 +176,7 @@ export default class Avatar {
this.textContent = text
}
- watch(name, old, val) {
- if (old === val) {
- return
- }
+ watch() {
switch (name) {
case 'src':
this.removeAttribute('hash')
diff --git a/src/badge/index.wc b/src/badge/index.wc
index 0daef5b..87727ca 100644
--- a/src/badge/index.wc
+++ b/src/badge/index.wc
@@ -64,10 +64,7 @@ export default class Badge {
this.__DOT__ = this.root.lastElementChild
}
- watch(name, old, val) {
- if (old === val) {
- return
- }
+ watch() {
switch (name) {
case 'label':
var num = Number(val)
diff --git a/src/form/button.wc b/src/form/button.wc
index eb69102..4690d06 100644
--- a/src/form/button.wc
+++ b/src/form/button.wc
@@ -313,10 +313,7 @@ export default class Button {
this.__BTN__.removeEventListener('click', this._handleClick)
}
- watch(name, old, val) {
- if (old === val) {
- return
- }
+ watch() {
switch (name) {
case 'icon':
this.props.icon = val
@@ -342,9 +339,7 @@ export default class Button {
case 'loading':
case 'disabled':
- if (val === '') {
- this[name] = true
- }
+ this[name] = true
break
}
}
diff --git a/src/form/cascader.wc b/src/form/cascader.wc
index d24bd57..e69de29 100644
--- a/src/form/cascader.wc
+++ b/src/form/cascader.wc
@@ -1,380 +0,0 @@
-
-
-
-
-
-
-
diff --git a/src/form/checkbox.wc b/src/form/checkbox.wc
index 00ffb62..03979de 100644
--- a/src/form/checkbox.wc
+++ b/src/form/checkbox.wc
@@ -220,10 +220,7 @@ export default class Checkbox {
)
}
- watch(name, old, val) {
- if (old === val) {
- return
- }
+ watch() {
switch (name) {
case 'label':
case 'color':
@@ -232,9 +229,7 @@ export default class Checkbox {
case 'checked':
case 'disabled':
- if (val === '') {
- this[name] = true
- }
+ this[name] = true
break
}
}
diff --git a/src/form/input.wc b/src/form/input.wc
index 5a8a454..0ff8cf0 100644
--- a/src/form/input.wc
+++ b/src/form/input.wc
@@ -480,10 +480,7 @@ export default class Input {
unbind(this.__LIST__, 'click', this._handleSelect)
}
- watch(name, old, val) {
- if (old === val) {
- return
- }
+ watch() {
switch (name) {
case 'icon':
this.props.icon = val
@@ -525,9 +522,7 @@ export default class Input {
case 'readonly':
case 'disabled':
- if (val === '') {
- this[name] = true
- }
+ this[name] = true
break
}
}
diff --git a/src/form/progress.wc b/src/form/progress.wc
index 62d3640..f2666bd 100644
--- a/src/form/progress.wc
+++ b/src/form/progress.wc
@@ -90,11 +90,7 @@ export default class Progress {
this.calculate()
}
- watch(name, old, val) {
- if (old === val) {
- return
- }
-
+ watch() {
switch (name) {
case max:
var max = +val
diff --git a/src/form/radio.wc b/src/form/radio.wc
index ba5aa6d..dd1836a 100644
--- a/src/form/radio.wc
+++ b/src/form/radio.wc
@@ -153,6 +153,8 @@