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(box)
ret.onclick = () => {
if (input.checked === false) {
span.animate(
[{ transform: "translateX(30px)" }], {
duration: 200,
fill: "forwards"
})
box.animate([{ backgroundColor: this.onTintColor }], {
duration: 200,
fill: "forwards"
})
input.checked = true
} else {
span.animate([{ transform: "translateX(0px)" }], {
duration: 200,
fill: "forwards"
})
box.animate([{ backgroundColor: this.offTintColor }], {
duration: 200,
fill: "forwards"
})
input.checked = false
}
if (this.onSwitchFuncId) {
this.callJSResponse(this.onSwitchFuncId, input.checked)
try {
if (input.checked === false) {
span.animate(
[{ transform: "translateX(0px)" }, { transform: "translateX(30px)" }], {
duration: 200,
fill: "forwards"
})
box.animate([{ backgroundColor: this.offTintColor }, { backgroundColor: this.onTintColor }], {
duration: 200,
fill: "forwards"
})
input.checked = true
} else {
span.animate([{ transform: "translateX(30px)" }, { transform: "translateX(0px)" }], {
duration: 200,
fill: "forwards"
})
box.animate([{ backgroundColor: this.onTintColor }, { backgroundColor: this.offTintColor }], {
duration: 200,
fill: "forwards"
})
input.checked = false
}
if (this.onSwitchFuncId) {
this.callJSResponse(this.onSwitchFuncId, input.checked)
}
} catch (e) {
alert(e)
}
}
this.input = input
this.span = span