微信小程序页面迁移校验之前 P5任务处理之前

This commit is contained in:
Neo
2026-03-09 01:19:21 +08:00
parent 263bf96035
commit 6e20987d2f
1112 changed files with 153824 additions and 219694 deletions

View File

@@ -0,0 +1,6 @@
{
"component": true,
"usingComponents": {
"t-rate": "tdesign-miniprogram/rate/rate"
}
}

View File

@@ -0,0 +1,38 @@
Component({
properties: {
/** 评分 0-10内部转换为 0-5 星 */
score: {
type: Number,
value: 0,
},
/** 星星尺寸 */
size: {
type: String,
value: '40rpx',
},
/** 是否只读 */
readonly: {
type: Boolean,
value: true,
},
},
observers: {
score(val: number) {
// score(0-10) → star(0-5)
const clamped = Math.max(0, Math.min(10, val))
this.setData({ starValue: clamped / 2 })
},
},
data: {
starValue: 0,
},
lifetimes: {
attached() {
const clamped = Math.max(0, Math.min(10, this.data.score))
this.setData({ starValue: clamped / 2 })
},
},
})

View File

@@ -0,0 +1,7 @@
<t-rate
value="{{starValue}}"
count="{{5}}"
allow-half
size="{{size}}"
disabled="{{readonly}}"
/>

View File

@@ -0,0 +1,3 @@
:host {
display: inline-block;
}