防止重复点击

This commit is contained in:
satori 2024-12-09 16:54:26 +08:00
parent dd854c7bfb
commit 06e35dc044
2 changed files with 9 additions and 4 deletions

View File

@ -77,9 +77,13 @@ document.body.appendChild(
div.text(item.content).h("4rem"), div.text(item.content).h("4rem"),
], ],
onclick: function (event) { onclick: function (event) {
if (this.dataset.lock) return
this.dataset.lock = true
const height = `${this.scrollHeight}px`
const { marginTop, marginBottom, paddingTop, paddingBottom } = this.style const { marginTop, marginBottom, paddingTop, paddingBottom } = this.style
console.log(marginTop, marginBottom, paddingTop, paddingBottom, height)
const animation = [ const animation = [
{ transform: "scaleY(1)", opacity: 1, height: this.scrollHeight + 'px', marginTop, marginBottom, paddingTop, paddingBottom }, { transform: "scaleY(1)", opacity: 1, height, marginTop, marginBottom, paddingTop, paddingBottom },
{ transform: "scaleY(0)", opacity: 0, height: 0, marginTop: 0, marginBottom: 0, paddingTop: 0, paddingBottom: 0 }, { transform: "scaleY(0)", opacity: 0, height: 0, marginTop: 0, marginBottom: 0, paddingTop: 0, paddingBottom: 0 },
] ]
this.animate(animation, { duration: 750, easing: "ease", fill: "forwards" }).onfinish = () => { this.animate(animation, { duration: 750, easing: "ease", fill: "forwards" }).onfinish = () => {

View File

@ -4,9 +4,10 @@
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"serve": "vue-cli-service serve", "build": "vite build",
"build": "vue-cli-service build", "vueserve": "vue-cli-service serve",
"lint": "vue-cli-service lint" "vuebuild": "vue-cli-service build",
"vuelint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"@laniakeasupercluster/widgets": "^1.1.8", "@laniakeasupercluster/widgets": "^1.1.8",