Skip to content

Commit c9375b7

Browse files
committed
chore: try add registry.json to tw.icebreaker.top
1 parent 4cc94da commit c9375b7

File tree

10 files changed

+141
-1
lines changed

10 files changed

+141
-1
lines changed

packages/wetw/README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,4 +84,16 @@ export default defineConfig({
8484
})
8585
```
8686

87-
随后执行 `wetw add button` 即可写入对应文件。\*\*\*
87+
随后执行 `wetw add button` 即可写入对应文件。
88+
89+
### 使用官方线上 registry
90+
91+
项目内置的线上清单可直接复用:
92+
93+
```ts
94+
export default defineConfig({
95+
registry: 'https://tw.icebreaker.top/wetw/registry.json',
96+
})
97+
```
98+
99+
当前包含 `counter``tag` 两个示例组件,对应源码由网站静态资源提供。

website/static/wetw/registry.json

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
[
2+
{
3+
"name": "counter",
4+
"description": "简单计数器组件,包含 ts/wxml/wxss/json 四个文件",
5+
"files": [
6+
{
7+
"path": "counter/index.ts",
8+
"src": "https://tw.icebreaker.top/wetw/templates/counter/index.ts"
9+
},
10+
{
11+
"path": "counter/index.wxml",
12+
"src": "https://tw.icebreaker.top/wetw/templates/counter/index.wxml"
13+
},
14+
{
15+
"path": "counter/index.wxss",
16+
"src": "https://tw.icebreaker.top/wetw/templates/counter/index.wxss"
17+
},
18+
{
19+
"path": "counter/index.json",
20+
"src": "https://tw.icebreaker.top/wetw/templates/counter/index.json"
21+
}
22+
]
23+
},
24+
{
25+
"name": "tag",
26+
"description": "语义色标签组件,支持 tone 与文本",
27+
"files": [
28+
{
29+
"path": "tag/index.ts",
30+
"src": "https://tw.icebreaker.top/wetw/templates/tag/index.ts"
31+
},
32+
{
33+
"path": "tag/index.wxml",
34+
"src": "https://tw.icebreaker.top/wetw/templates/tag/index.wxml"
35+
},
36+
{
37+
"path": "tag/index.wxss",
38+
"src": "https://tw.icebreaker.top/wetw/templates/tag/index.wxss"
39+
},
40+
{
41+
"path": "tag/index.json",
42+
"src": "https://tw.icebreaker.top/wetw/templates/tag/index.json"
43+
}
44+
]
45+
}
46+
]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"component": true
3+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
Component({
2+
data: {
3+
count: 0,
4+
},
5+
methods: {
6+
inc() {
7+
this.setData({ count: this.data.count + 1 })
8+
},
9+
dec() {
10+
this.setData({ count: this.data.count - 1 })
11+
},
12+
},
13+
})
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<view class="wetw-counter">
2+
<button class="wetw-counter__btn" bindtap="dec">-</button>
3+
<text class="wetw-counter__value">{{count}}</text>
4+
<button class="wetw-counter__btn" bindtap="inc">+</button>
5+
</view>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
.wetw-counter {
2+
display: flex;
3+
align-items: center;
4+
gap: 8rpx;
5+
}
6+
7+
.wetw-counter__btn {
8+
padding: 12rpx 20rpx;
9+
background: #111827;
10+
border-radius: 12rpx;
11+
color: #fff;
12+
}
13+
14+
.wetw-counter__value {
15+
min-width: 64rpx;
16+
text-align: center;
17+
font-weight: 600;
18+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"component": true
3+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
Component({
2+
properties: {
3+
tone: {
4+
type: String,
5+
value: 'primary',
6+
},
7+
text: {
8+
type: String,
9+
value: '标签',
10+
},
11+
},
12+
})
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<view class="wetw-tag wetw-tag--{{tone}}">
2+
<text>{{text}}</text>
3+
</view>
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
.wetw-tag {
2+
display: inline-flex;
3+
align-items: center;
4+
gap: 8rpx;
5+
padding: 6rpx 14rpx;
6+
border-radius: 14rpx;
7+
font-size: 24rpx;
8+
line-height: 1.4;
9+
font-weight: 600;
10+
}
11+
12+
.wetw-tag--primary {
13+
background-color: #0ea5e9;
14+
color: #f8fafc;
15+
}
16+
17+
.wetw-tag--neutral {
18+
background-color: #f1f5f9;
19+
color: #0f172a;
20+
}
21+
22+
.wetw-tag--danger {
23+
background-color: #fef2f2;
24+
color: #991b1b;
25+
}

0 commit comments

Comments
 (0)