web:compat some browser

This commit is contained in:
pengfei.zhou 2021-04-19 20:55:32 +08:00 committed by osborn
parent c54c4442b5
commit 03e3630d02

View File

@ -33,31 +33,37 @@ export class DoricSwitchNode extends DoricViewNode {
ret.appendChild(input) ret.appendChild(input)
ret.appendChild(box) ret.appendChild(box)
ret.onclick = () => { ret.onclick = () => {
if (input.checked === false) { try {
span.animate(
[{ transform: "translateX(30px)" }], { if (input.checked === false) {
duration: 200, span.animate(
fill: "forwards" [{ transform: "translateX(0px)" }, { transform: "translateX(30px)" }], {
}) duration: 200,
box.animate([{ backgroundColor: this.onTintColor }], { fill: "forwards"
duration: 200, })
fill: "forwards" box.animate([{ backgroundColor: this.offTintColor }, { backgroundColor: this.onTintColor }], {
}) duration: 200,
input.checked = true fill: "forwards"
} else { })
span.animate([{ transform: "translateX(0px)" }], { input.checked = true
duration: 200, } else {
fill: "forwards" span.animate([{ transform: "translateX(30px)" }, { transform: "translateX(0px)" }], {
}) duration: 200,
box.animate([{ backgroundColor: this.offTintColor }], { fill: "forwards"
duration: 200, })
fill: "forwards" box.animate([{ backgroundColor: this.onTintColor }, { backgroundColor: this.offTintColor }], {
}) duration: 200,
input.checked = false fill: "forwards"
} })
if (this.onSwitchFuncId) { input.checked = false
this.callJSResponse(this.onSwitchFuncId, input.checked) }
if (this.onSwitchFuncId) {
this.callJSResponse(this.onSwitchFuncId, input.checked)
}
} catch (e) {
alert(e)
} }
} }
this.input = input this.input = input
this.span = span this.span = span