Initial commit

Made-with: Cursor
This commit is contained in:
Daniel
2026-02-28 18:39:00 +08:00
commit a94bd44c3a
49 changed files with 917 additions and 0 deletions

View File

@@ -0,0 +1,4 @@
{
"component": true,
"usingComponents": {}
}

View File

@@ -0,0 +1,22 @@
Component({
properties: {
text: { type: String, value: '确认' },
duration: { type: Number, value: 3 },
},
data: { countdown: 0, loading: false },
methods: {
onTap() {
if (this.data.countdown > 0 || this.data.loading) return;
this.setData({ countdown: this.properties.duration });
const t = setInterval(() => {
const n = this.data.countdown - 1;
this.setData({ countdown: n });
if (n <= 0) clearInterval(t);
}, 1000);
this.triggerEvent('confirm');
},
setLoading(v: boolean) {
this.setData({ loading: v });
},
},
});

View File

@@ -0,0 +1,8 @@
<button
class="cooldown-btn"
disabled="{{countdown > 0 || loading}}"
loading="{{loading}}"
bindtap="onTap"
>
{{countdown > 0 ? countdown + '秒' : (loading ? '提交中' : text)}}
</button>

View File

@@ -0,0 +1,12 @@
.cooldown-btn {
width: 100%;
padding: 28rpx;
border-radius: 16rpx;
font-size: 32rpx;
background: #5a9;
color: #fff;
border: none;
}
.cooldown-btn[disabled] {
background: #888;
}