Initial commit
Made-with: Cursor
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"component": true,
|
||||
"usingComponents": {}
|
||||
}
|
||||
19
srde/miniprogram/components/status-badge/status-badge.ts
Normal file
19
srde/miniprogram/components/status-badge/status-badge.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
const STATUS_TEXT: Record<string, string> = {
|
||||
tradable: '可交易',
|
||||
compressed: '风险压缩',
|
||||
locked: '锁仓',
|
||||
};
|
||||
|
||||
Component({
|
||||
properties: {
|
||||
status: { type: String, value: 'tradable' },
|
||||
text: { type: String, value: '' },
|
||||
},
|
||||
lifetimes: {
|
||||
attached() {
|
||||
const s = this.properties.status;
|
||||
const t = this.properties.text || STATUS_TEXT[s] || s;
|
||||
this.setData({ text: t });
|
||||
},
|
||||
},
|
||||
});
|
||||
@@ -0,0 +1 @@
|
||||
<view class="badge status-{{status}}">{{text || (status === 'tradable' ? '可交易' : (status === 'compressed' ? '风险压缩' : '锁仓'))}}</view>
|
||||
@@ -0,0 +1,9 @@
|
||||
.badge {
|
||||
display: inline-block;
|
||||
padding: 8rpx 20rpx;
|
||||
border-radius: 24rpx;
|
||||
font-size: 24rpx;
|
||||
}
|
||||
.status-tradable { background: rgba(85,170,153,0.2); color: #5a9; }
|
||||
.status-compressed { background: rgba(187,153,85,0.2); color: #b95; }
|
||||
.status-locked { background: rgba(170,68,68,0.2); color: #a44; }
|
||||
Reference in New Issue
Block a user