create-uni-app-tailwindcss 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +23 -0
- package/dist/cli.js +150 -0
- package/dist/templates/default/.eslintrc-auto-import.json +115 -0
- package/dist/templates/default/README.md +140 -0
- package/dist/templates/default/_npmrc +8 -0
- package/dist/templates/default/eslint.config.mjs +27 -0
- package/dist/templates/default/index.html +24 -0
- package/dist/templates/default/package.json +105 -0
- package/dist/templates/default/scripts/app-css-smoke.mjs +69 -0
- package/dist/templates/default/scripts/hmr-smoke.mjs +252 -0
- package/dist/templates/default/src/App.vue +11 -0
- package/dist/templates/default/src/auto-imports.d.ts +109 -0
- package/dist/templates/default/src/components/WeappTailwindcss.vue +51 -0
- package/dist/templates/default/src/components/sections/CapabilityShowcase.vue +59 -0
- package/dist/templates/default/src/components/sections/ExperienceLab.vue +321 -0
- package/dist/templates/default/src/components/sections/GradientFeature.vue +128 -0
- package/dist/templates/default/src/components/sections/HeroShowcase.vue +14 -0
- package/dist/templates/default/src/components/sections/IconGallery.vue +58 -0
- package/dist/templates/default/src/components/sections/MacroShowcase.vue +156 -0
- package/dist/templates/default/src/env.d.ts +8 -0
- package/dist/templates/default/src/main.ts +13 -0
- package/dist/templates/default/src/manifest.json +56 -0
- package/dist/templates/default/src/pages/index/index.vue +49 -0
- package/dist/templates/default/src/pages.json +16 -0
- package/dist/templates/default/src/static/.gitkeep +0 -0
- package/dist/templates/default/src/static/images/weapp-tailwindcss.png +0 -0
- package/dist/templates/default/src/stores/counter.ts +11 -0
- package/dist/templates/default/src/tailwind.css +62 -0
- package/dist/templates/default/src/theme.json +10 -0
- package/dist/templates/default/src/uni.scss +0 -0
- package/dist/templates/default/stylelint.config.mjs +3 -0
- package/dist/templates/default/tsconfig.json +33 -0
- package/dist/templates/default/vite.config.ts +37 -0
- package/dist/templates/registry.json +25 -0
- package/package.json +53 -0
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { useCounterStore } from '@/stores/counter'
|
|
3
|
+
|
|
4
|
+
const store = useCounterStore()
|
|
5
|
+
const { count } = storeToRefs(store)
|
|
6
|
+
const { increment } = store
|
|
7
|
+
const buttonColors = [
|
|
8
|
+
'bg-[#000]',
|
|
9
|
+
'bg-[#111]',
|
|
10
|
+
'bg-[#222]',
|
|
11
|
+
'bg-[#333]',
|
|
12
|
+
'bg-[#444]',
|
|
13
|
+
'bg-[#555]',
|
|
14
|
+
'bg-[#666]',
|
|
15
|
+
'bg-[#777]',
|
|
16
|
+
'bg-[#888]',
|
|
17
|
+
'bg-[#999]',
|
|
18
|
+
'bg-[#aaa]',
|
|
19
|
+
'bg-[#bbb]',
|
|
20
|
+
'bg-[#ccc]',
|
|
21
|
+
'bg-[#ddd]',
|
|
22
|
+
'bg-[#eee]',
|
|
23
|
+
'bg-[#fff]',
|
|
24
|
+
]
|
|
25
|
+
const buttonPalette = buttonColors.map((color, index) => ({
|
|
26
|
+
bg: color,
|
|
27
|
+
tone: index < 8 ? 'dark' : 'light',
|
|
28
|
+
}))
|
|
29
|
+
const buttonClass = computed(() => {
|
|
30
|
+
const palette = buttonPalette[count.value % buttonPalette.length]
|
|
31
|
+
if (palette.tone === 'dark') {
|
|
32
|
+
return [palette.bg, 'text-white ring-1 ring-white/20']
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return [
|
|
36
|
+
palette.bg,
|
|
37
|
+
'text-slate-900 ring-2 ring-slate-200/80 hover:ring-slate-300/80',
|
|
38
|
+
]
|
|
39
|
+
})
|
|
40
|
+
const themeRef = ref(uni.getSystemInfoSync().theme)
|
|
41
|
+
const themeLabel = computed(() => (themeRef.value === 'dark' ? '暗色主题' : '浅色主题'))
|
|
42
|
+
const proTips = [
|
|
43
|
+
{
|
|
44
|
+
title: 'pseudo + hover',
|
|
45
|
+
detail: 'after:content-[\'hover_here!\'] + hover-class',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
title: '@apply',
|
|
49
|
+
detail: 'test / apply-class-0 / apply-class-1 支持宏组合',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: 'Grid + Icon',
|
|
53
|
+
detail: '[&_text]:text-[32px] + iconify i-* 系列',
|
|
54
|
+
},
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
let themeChangeHandler: ((options: { theme: 'dark' | 'light' }) => void) | null = null
|
|
58
|
+
|
|
59
|
+
// #ifdef MP
|
|
60
|
+
function registerThemeChange() {
|
|
61
|
+
themeChangeHandler = ({ theme }: { theme: 'dark' | 'light' }) => {
|
|
62
|
+
themeRef.value = theme
|
|
63
|
+
}
|
|
64
|
+
uni.onThemeChange(themeChangeHandler)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
registerThemeChange()
|
|
68
|
+
// #endif
|
|
69
|
+
|
|
70
|
+
onBeforeUnmount(() => {
|
|
71
|
+
// #ifdef MP
|
|
72
|
+
if (themeChangeHandler) {
|
|
73
|
+
uni.offThemeChange(themeChangeHandler)
|
|
74
|
+
themeChangeHandler = null
|
|
75
|
+
}
|
|
76
|
+
// #endif
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
function copy(data: string) {
|
|
80
|
+
uni.setClipboardData({
|
|
81
|
+
data,
|
|
82
|
+
})
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
85
|
+
|
|
86
|
+
<template>
|
|
87
|
+
<view
|
|
88
|
+
class="
|
|
89
|
+
rounded-[32rpx] border border-slate-100/70 bg-white/90 p-5
|
|
90
|
+
shadow-[0_20px_45px_rgba(15,23,42,0.08)]
|
|
91
|
+
"
|
|
92
|
+
>
|
|
93
|
+
<view class="flex flex-col gap-2">
|
|
94
|
+
<view class="text-xs uppercase tracking-[6rpx] text-slate-400">
|
|
95
|
+
即时体验
|
|
96
|
+
</view>
|
|
97
|
+
<view class="text-2xl font-semibold text-slate-900">
|
|
98
|
+
Tailwind 原子能力搭配 Pinia/uni-api
|
|
99
|
+
</view>
|
|
100
|
+
</view>
|
|
101
|
+
<view
|
|
102
|
+
class="
|
|
103
|
+
mt-4 flex flex-col gap-4
|
|
104
|
+
lg:grid lg:grid-cols-3
|
|
105
|
+
"
|
|
106
|
+
>
|
|
107
|
+
<view
|
|
108
|
+
class="
|
|
109
|
+
flex flex-col gap-3 rounded-[28rpx] border border-slate-200/80
|
|
110
|
+
bg-gradient-to-br from-slate-900/95 to-slate-700/95 p-4 text-white
|
|
111
|
+
shadow-xl
|
|
112
|
+
"
|
|
113
|
+
>
|
|
114
|
+
<view class="text-xs uppercase tracking-[6rpx] text-white/60">
|
|
115
|
+
动态配色按钮
|
|
116
|
+
</view>
|
|
117
|
+
<view class="text-3xl font-semibold">
|
|
118
|
+
{{ count }}
|
|
119
|
+
</view>
|
|
120
|
+
<view class="text-xs text-white/70">
|
|
121
|
+
buttonColors + computed + Pinia
|
|
122
|
+
</view>
|
|
123
|
+
<button
|
|
124
|
+
class="
|
|
125
|
+
raw-btn w-full rounded-2xl py-2 text-base font-semibold shadow-lg
|
|
126
|
+
transition hover:scale-[1.01]
|
|
127
|
+
"
|
|
128
|
+
:class="buttonClass"
|
|
129
|
+
@click="increment"
|
|
130
|
+
>
|
|
131
|
+
click to inc
|
|
132
|
+
</button>
|
|
133
|
+
<view class="text-xs text-white/70">
|
|
134
|
+
任意色值 `bg-[#xxx]` + hover 保留
|
|
135
|
+
</view>
|
|
136
|
+
<view class="test">
|
|
137
|
+
@apply + 自定义尺寸
|
|
138
|
+
</view>
|
|
139
|
+
</view>
|
|
140
|
+
|
|
141
|
+
<view
|
|
142
|
+
class="
|
|
143
|
+
flex flex-col gap-3 rounded-[28rpx] border border-slate-200/80
|
|
144
|
+
bg-white/85 p-4 shadow-xl backdrop-blur-lg
|
|
145
|
+
"
|
|
146
|
+
>
|
|
147
|
+
<view class="text-xs uppercase tracking-[6rpx] text-slate-500">
|
|
148
|
+
theme 监听
|
|
149
|
+
</view>
|
|
150
|
+
<view class="text-3xl font-semibold text-slate-900">
|
|
151
|
+
{{ themeLabel }}
|
|
152
|
+
</view>
|
|
153
|
+
<view class="text-xs text-slate-500">
|
|
154
|
+
uni.onThemeChange -> ref / computed
|
|
155
|
+
</view>
|
|
156
|
+
<view
|
|
157
|
+
class="
|
|
158
|
+
mt-4 rounded-2xl border border-dashed border-slate-200
|
|
159
|
+
bg-slate-50/70 p-3 text-[26rpx] text-slate-600
|
|
160
|
+
"
|
|
161
|
+
>
|
|
162
|
+
themeRef: {{ themeRef }}
|
|
163
|
+
</view>
|
|
164
|
+
<view class="mt-4">
|
|
165
|
+
<view class="text-sm font-semibold text-slate-600">
|
|
166
|
+
wx / not-wx 自定义 variant
|
|
167
|
+
</view>
|
|
168
|
+
<view class="text-xs text-slate-500">
|
|
169
|
+
通过 @custom-variant 直接承载条件编译
|
|
170
|
+
</view>
|
|
171
|
+
<view class="mt-2 flex flex-wrap gap-2 text-xs">
|
|
172
|
+
<view
|
|
173
|
+
class="
|
|
174
|
+
rounded-full bg-slate-900/5 px-3 py-1 font-semibold
|
|
175
|
+
text-slate-600
|
|
176
|
+
"
|
|
177
|
+
@click="copy('https://tw.icebreaker.top/docs/guide')"
|
|
178
|
+
>
|
|
179
|
+
点击复制文档
|
|
180
|
+
</view>
|
|
181
|
+
</view>
|
|
182
|
+
</view>
|
|
183
|
+
</view>
|
|
184
|
+
|
|
185
|
+
<view
|
|
186
|
+
class="
|
|
187
|
+
flex flex-col gap-3 rounded-[28rpx] border border-slate-200/80
|
|
188
|
+
bg-white/85 p-4 shadow-xl backdrop-blur-lg
|
|
189
|
+
"
|
|
190
|
+
>
|
|
191
|
+
<view class="text-xs uppercase tracking-[6rpx] text-slate-500">
|
|
192
|
+
hover + group + ring
|
|
193
|
+
</view>
|
|
194
|
+
<view class="text-sm text-slate-500">
|
|
195
|
+
hover-class + group-[.published]
|
|
196
|
+
</view>
|
|
197
|
+
<view
|
|
198
|
+
class="
|
|
199
|
+
mt-3 flex h-16 w-32 items-center justify-center rounded-[20rpx]
|
|
200
|
+
bg-[#389f2bb1] text-white
|
|
201
|
+
after:content-['hover_here!']
|
|
202
|
+
"
|
|
203
|
+
hover-class="!bg-[gray] after:!content-['good_work!']"
|
|
204
|
+
/>
|
|
205
|
+
<view class="text-xs text-slate-500">
|
|
206
|
+
pseudo + hover-class
|
|
207
|
+
</view>
|
|
208
|
+
<view class="mt-3 text-neutral-400">
|
|
209
|
+
group published 示例
|
|
210
|
+
</view>
|
|
211
|
+
<view
|
|
212
|
+
class="
|
|
213
|
+
group relative rounded-2xl bg-green-200/70 p-[60px] text-xs
|
|
214
|
+
text-slate-700
|
|
215
|
+
before:absolute before:left-1 before:top-1 before:text-slate-500
|
|
216
|
+
before:content-['父元素']
|
|
217
|
+
"
|
|
218
|
+
hover-class="published"
|
|
219
|
+
>
|
|
220
|
+
<view
|
|
221
|
+
class="
|
|
222
|
+
rounded-xl bg-pink-400/80 p-2 text-white ring-4 ring-pink-200
|
|
223
|
+
group-[.published]:bg-yellow-400 group-[.published]:text-slate-800
|
|
224
|
+
"
|
|
225
|
+
>
|
|
226
|
+
hover 父元素使得子元素背景变成黄色
|
|
227
|
+
</view>
|
|
228
|
+
</view>
|
|
229
|
+
</view>
|
|
230
|
+
</view>
|
|
231
|
+
|
|
232
|
+
<view
|
|
233
|
+
class="
|
|
234
|
+
mt-5 flex flex-col gap-4
|
|
235
|
+
md:grid md:grid-cols-2
|
|
236
|
+
"
|
|
237
|
+
>
|
|
238
|
+
<view
|
|
239
|
+
class="
|
|
240
|
+
rounded-[26rpx] border border-slate-200/80 bg-white/70 p-4
|
|
241
|
+
shadow-inner
|
|
242
|
+
"
|
|
243
|
+
>
|
|
244
|
+
<view class="text-sm font-semibold text-slate-700">
|
|
245
|
+
Tailwind ring + 自定义按钮
|
|
246
|
+
</view>
|
|
247
|
+
<view class="text-xs text-slate-500">
|
|
248
|
+
ring utilities
|
|
249
|
+
</view>
|
|
250
|
+
<view
|
|
251
|
+
class="
|
|
252
|
+
mt-4 grid grid-cols-1 gap-3
|
|
253
|
+
sm:grid-cols-2
|
|
254
|
+
"
|
|
255
|
+
>
|
|
256
|
+
<view
|
|
257
|
+
class="
|
|
258
|
+
w-full rounded-md bg-pink-500 py-2 text-center font-semibold
|
|
259
|
+
text-white ring-4 ring-pink-300
|
|
260
|
+
"
|
|
261
|
+
>
|
|
262
|
+
Default Ring
|
|
263
|
+
</view>
|
|
264
|
+
<button class="btn">
|
|
265
|
+
@layer 定制按钮
|
|
266
|
+
</button>
|
|
267
|
+
</view>
|
|
268
|
+
</view>
|
|
269
|
+
|
|
270
|
+
<view
|
|
271
|
+
class="
|
|
272
|
+
rounded-[26rpx] border border-slate-200/80 bg-white/70 p-4
|
|
273
|
+
shadow-inner
|
|
274
|
+
"
|
|
275
|
+
>
|
|
276
|
+
<view class="text-sm font-semibold text-slate-700">
|
|
277
|
+
Pro tips
|
|
278
|
+
</view>
|
|
279
|
+
<view class="text-xs text-slate-500">
|
|
280
|
+
结合 Icon、伪元素、Grid
|
|
281
|
+
</view>
|
|
282
|
+
<view class="mt-3 space-y-2">
|
|
283
|
+
<view
|
|
284
|
+
v-for="tip in proTips"
|
|
285
|
+
:key="tip.title"
|
|
286
|
+
class="
|
|
287
|
+
rounded-2xl border border-slate-100/80 bg-slate-50/60 px-3 py-2
|
|
288
|
+
text-[26rpx] text-slate-600
|
|
289
|
+
"
|
|
290
|
+
>
|
|
291
|
+
<view class="font-semibold text-slate-700">
|
|
292
|
+
{{ tip.title }}
|
|
293
|
+
</view>
|
|
294
|
+
<view class="text-slate-500">
|
|
295
|
+
{{ tip.detail }}
|
|
296
|
+
</view>
|
|
297
|
+
</view>
|
|
298
|
+
</view>
|
|
299
|
+
<view class="mt-4 text-neutral-600 underline" @click="copy('https://tw.icebreaker.top/docs/icons')">
|
|
300
|
+
Grid布局 + Icon 方案(点击复制链接)
|
|
301
|
+
</view>
|
|
302
|
+
</view>
|
|
303
|
+
</view>
|
|
304
|
+
</view>
|
|
305
|
+
</template>
|
|
306
|
+
|
|
307
|
+
<style scoped>
|
|
308
|
+
.test {
|
|
309
|
+
display: flex !important;
|
|
310
|
+
align-items: center;
|
|
311
|
+
justify-content: center;
|
|
312
|
+
width: 222.222px;
|
|
313
|
+
max-width: 100%;
|
|
314
|
+
height: 100px;
|
|
315
|
+
box-sizing: border-box;
|
|
316
|
+
border-radius: 40px;
|
|
317
|
+
background-color: rgb(18 52 86 / 0.54);
|
|
318
|
+
color: #ffffff;
|
|
319
|
+
text-align: center;
|
|
320
|
+
}
|
|
321
|
+
</style>
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const gradientShowcase = [
|
|
3
|
+
{
|
|
4
|
+
name: '极光之窗',
|
|
5
|
+
desc: 'bg-[radial-gradient(circle_at_top,#22d3ee,#0f172a)]',
|
|
6
|
+
classes: 'bg-[radial-gradient(circle_at_top,#22d3ee,#0f172a)] text-white',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
name: '玻璃注脚',
|
|
10
|
+
desc: 'bg-white/70 backdrop-blur-xl border border-white/40',
|
|
11
|
+
classes: 'bg-white/70 border border-white/40 text-slate-700 backdrop-blur-xl',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
name: '霓虹波纹',
|
|
15
|
+
desc: 'bg-[conic-gradient(at_top,#0ea5e9,#6366f1,#a855f7)]',
|
|
16
|
+
classes: 'bg-[conic-gradient(at_top,#0ea5e9,#6366f1,#a855f7)] text-white',
|
|
17
|
+
},
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
const featureCards = [
|
|
21
|
+
{
|
|
22
|
+
icon: 'i-[mdi--view-grid-outline]',
|
|
23
|
+
title: '栅格 + 弹性',
|
|
24
|
+
desc: 'flex、grid、aspect-ratio 等原子类直接可用,快速搭组件。',
|
|
25
|
+
chip: 'Layout',
|
|
26
|
+
accent: 'text-sky-500',
|
|
27
|
+
backdrop: 'from-sky-500/15 to-cyan-500/15',
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
icon: 'i-[mdi--brightness-auto]',
|
|
31
|
+
title: '主题同步',
|
|
32
|
+
desc: 'uni.onThemeChange + tailwind,深浅模式自动切换。',
|
|
33
|
+
chip: 'Theme',
|
|
34
|
+
accent: 'text-indigo-500',
|
|
35
|
+
backdrop: 'from-indigo-500/15 to-purple-500/15',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
icon: 'i-[mdi--all-inclusive]',
|
|
39
|
+
title: '任意值语法',
|
|
40
|
+
desc: 'bg-[url(...)], rounded-[20rpx], after:content-[] 统统搞定。',
|
|
41
|
+
chip: '[]',
|
|
42
|
+
accent: 'text-rose-500',
|
|
43
|
+
backdrop: 'from-rose-500/15 to-orange-500/15',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
icon: 'i-[mdi--rocket-launch-outline]',
|
|
47
|
+
title: 'Icon + Animate',
|
|
48
|
+
desc: 'iconify + animate + ring,覆盖状态、加载、空态。',
|
|
49
|
+
chip: 'Icon',
|
|
50
|
+
accent: 'text-emerald-500',
|
|
51
|
+
backdrop: 'from-emerald-500/15 to-teal-500/15',
|
|
52
|
+
},
|
|
53
|
+
]
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<template>
|
|
57
|
+
<view
|
|
58
|
+
class="
|
|
59
|
+
rounded-[32rpx] border border-slate-100/70 bg-white/90 p-5
|
|
60
|
+
shadow-[0_20px_45px_rgba(15,23,42,0.08)]
|
|
61
|
+
"
|
|
62
|
+
>
|
|
63
|
+
<view class="text-xs uppercase tracking-[6rpx] text-slate-400">
|
|
64
|
+
渐变 & 玻璃
|
|
65
|
+
</view>
|
|
66
|
+
<view class="text-2xl font-semibold text-slate-900">
|
|
67
|
+
自由的视觉语言
|
|
68
|
+
</view>
|
|
69
|
+
<view
|
|
70
|
+
class="
|
|
71
|
+
mt-4 flex flex-col gap-4
|
|
72
|
+
md:grid md:grid-cols-3
|
|
73
|
+
"
|
|
74
|
+
>
|
|
75
|
+
<view
|
|
76
|
+
v-for="item in gradientShowcase"
|
|
77
|
+
:key="item.name"
|
|
78
|
+
class="rounded-[28rpx] p-4 shadow-lg"
|
|
79
|
+
:class="item.classes"
|
|
80
|
+
>
|
|
81
|
+
<view class="text-xl font-semibold">
|
|
82
|
+
{{ item.name }}
|
|
83
|
+
</view>
|
|
84
|
+
<view class="text-xs opacity-80">
|
|
85
|
+
{{ item.desc }}
|
|
86
|
+
</view>
|
|
87
|
+
</view>
|
|
88
|
+
</view>
|
|
89
|
+
|
|
90
|
+
<view class="mt-5 text-sm text-slate-500">
|
|
91
|
+
feature cards
|
|
92
|
+
</view>
|
|
93
|
+
<view
|
|
94
|
+
class="
|
|
95
|
+
mt-3 flex flex-col gap-4
|
|
96
|
+
md:grid md:grid-cols-2
|
|
97
|
+
"
|
|
98
|
+
>
|
|
99
|
+
<view
|
|
100
|
+
v-for="feature in featureCards"
|
|
101
|
+
:key="feature.title"
|
|
102
|
+
class="
|
|
103
|
+
rounded-[28rpx] border border-slate-100/80 bg-gradient-to-br p-4
|
|
104
|
+
shadow-lg
|
|
105
|
+
"
|
|
106
|
+
:class="feature.backdrop"
|
|
107
|
+
>
|
|
108
|
+
<view class="flex items-center gap-3">
|
|
109
|
+
<text class="text-[36px]" :class="[feature.icon, feature.accent]" />
|
|
110
|
+
<view class="text-lg font-semibold text-slate-800">
|
|
111
|
+
{{ feature.title }}
|
|
112
|
+
</view>
|
|
113
|
+
</view>
|
|
114
|
+
<view class="mt-1 text-xs text-slate-500">
|
|
115
|
+
{{ feature.desc }}
|
|
116
|
+
</view>
|
|
117
|
+
<view
|
|
118
|
+
class="
|
|
119
|
+
mt-3 inline-flex rounded-full bg-white/70 px-3 py-1 text-xs
|
|
120
|
+
font-semibold text-slate-600
|
|
121
|
+
"
|
|
122
|
+
>
|
|
123
|
+
{{ feature.chip }}
|
|
124
|
+
</view>
|
|
125
|
+
</view>
|
|
126
|
+
</view>
|
|
127
|
+
</view>
|
|
128
|
+
</template>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import WeappTailwindcss from '@/components/WeappTailwindcss.vue'
|
|
3
|
+
</script>
|
|
4
|
+
|
|
5
|
+
<template>
|
|
6
|
+
<view
|
|
7
|
+
class="
|
|
8
|
+
rounded-[32rpx] border border-slate-100/70 bg-white/90 p-5
|
|
9
|
+
shadow-[0_20px_45px_rgba(15,23,42,0.08)]
|
|
10
|
+
"
|
|
11
|
+
>
|
|
12
|
+
<WeappTailwindcss />
|
|
13
|
+
</view>
|
|
14
|
+
</template>
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
const showAccent = ref(true)
|
|
3
|
+
const accentClass = computed(() => (showAccent.value
|
|
4
|
+
? [
|
|
5
|
+
'bg-[#aa00aa]',
|
|
6
|
+
'text-[#ffffffee]',
|
|
7
|
+
'border-transparent',
|
|
8
|
+
'shadow-[0_32px_60px_rgba(170,0,170,0.45)]',
|
|
9
|
+
]
|
|
10
|
+
: []))
|
|
11
|
+
const iconList = [
|
|
12
|
+
'i-[svg-spinners--12-dots-scale-rotate]',
|
|
13
|
+
'i-[svg-spinners--180-ring]',
|
|
14
|
+
'i-[svg-spinners--3-dots-bounce]',
|
|
15
|
+
'i-[svg-spinners--6-dots-rotate]',
|
|
16
|
+
'i-[svg-spinners--90-ring]',
|
|
17
|
+
'i-[svg-spinners--bars-fade]',
|
|
18
|
+
'i-[svg-spinners--blocks-scale]',
|
|
19
|
+
'i-[svg-spinners--clock]',
|
|
20
|
+
'i-[svg-spinners--tadpole]',
|
|
21
|
+
]
|
|
22
|
+
</script>
|
|
23
|
+
|
|
24
|
+
<template>
|
|
25
|
+
<view
|
|
26
|
+
class="
|
|
27
|
+
rounded-[32rpx] border border-slate-100/70 bg-white/90 p-5
|
|
28
|
+
shadow-[0_20px_45px_rgba(15,23,42,0.08)]
|
|
29
|
+
"
|
|
30
|
+
>
|
|
31
|
+
<view class="text-xs uppercase tracking-[6rpx] text-slate-400">
|
|
32
|
+
Icon + 动画
|
|
33
|
+
</view>
|
|
34
|
+
<view class="text-2xl font-semibold text-slate-900">
|
|
35
|
+
iconify 集合与 Grid 自由组合
|
|
36
|
+
</view>
|
|
37
|
+
<view
|
|
38
|
+
class="
|
|
39
|
+
mt-4 grid grid-cols-3 gap-3 rounded-[28rpx] border border-slate-100
|
|
40
|
+
bg-slate-50/80 p-3 text-center
|
|
41
|
+
sm:grid-cols-4
|
|
42
|
+
md:grid-cols-6
|
|
43
|
+
"
|
|
44
|
+
>
|
|
45
|
+
<view
|
|
46
|
+
v-for="(icon, index) in iconList"
|
|
47
|
+
:key="icon"
|
|
48
|
+
class="
|
|
49
|
+
w-full rounded-2xl border border-white/80 bg-white py-3 text-slate-700
|
|
50
|
+
shadow-[0_20px_40px_rgba(15,23,42,0.1)]
|
|
51
|
+
"
|
|
52
|
+
:class="index % 2 === 0 ? accentClass : undefined"
|
|
53
|
+
>
|
|
54
|
+
<text class="text-[32px]" :class="icon" />
|
|
55
|
+
</view>
|
|
56
|
+
</view>
|
|
57
|
+
</view>
|
|
58
|
+
</template>
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
function copy(data: string) {
|
|
3
|
+
uni.setClipboardData({
|
|
4
|
+
data,
|
|
5
|
+
})
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const hashTag = '#'
|
|
9
|
+
const variantLines = [
|
|
10
|
+
'@custom-variant wx {',
|
|
11
|
+
` /* ${hashTag}ifdef MP-WEIXIN */`,
|
|
12
|
+
' @slot;',
|
|
13
|
+
` /* ${hashTag}endif */`,
|
|
14
|
+
'}',
|
|
15
|
+
'',
|
|
16
|
+
'@custom-variant not-wx {',
|
|
17
|
+
` /* ${hashTag}ifndef MP-WEIXIN */`,
|
|
18
|
+
' @slot;',
|
|
19
|
+
` /* ${hashTag}endif */`,
|
|
20
|
+
'}',
|
|
21
|
+
]
|
|
22
|
+
const variantSnippet = variantLines.join('\n')
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<template>
|
|
26
|
+
<view
|
|
27
|
+
class="
|
|
28
|
+
rounded-[32rpx] border border-slate-100/70 bg-white/90 p-5
|
|
29
|
+
shadow-[0_20px_45px_rgba(15,23,42,0.08)]
|
|
30
|
+
"
|
|
31
|
+
>
|
|
32
|
+
<view class="text-xs uppercase tracking-[6rpx] text-slate-400">
|
|
33
|
+
条件编译
|
|
34
|
+
</view>
|
|
35
|
+
<view class="text-2xl font-semibold text-slate-900">
|
|
36
|
+
用 @custom-variant 直接表达宿主差异
|
|
37
|
+
</view>
|
|
38
|
+
<view class="mt-4 space-y-4">
|
|
39
|
+
<view class="text-sm text-neutral-600">
|
|
40
|
+
现在不再依赖 weapp-tailwindcss/css-macro,而是把宿主分支写成 wx / not-wx。
|
|
41
|
+
</view>
|
|
42
|
+
<view class="rounded-[24rpx] border border-dashed border-slate-200 bg-slate-50/80 p-4 text-sm text-slate-600">
|
|
43
|
+
<view class="mb-2 flex items-center justify-between gap-3">
|
|
44
|
+
<view class="text-neutral-400">
|
|
45
|
+
配置示例
|
|
46
|
+
</view>
|
|
47
|
+
<text class="text-sky-400 underline" @click="copy(variantSnippet)">
|
|
48
|
+
复制片段
|
|
49
|
+
</text>
|
|
50
|
+
</view>
|
|
51
|
+
<view class="rounded-2xl bg-white/80 p-3 text-[24rpx] leading-6 text-slate-700">
|
|
52
|
+
<view
|
|
53
|
+
v-for="(line, index) in variantLines"
|
|
54
|
+
:key="`${index}-${line}`"
|
|
55
|
+
:class="{ 'mt-2': index === 6, 'pl-3': line.startsWith(' ') }"
|
|
56
|
+
>
|
|
57
|
+
{{ line || ' ' }}
|
|
58
|
+
</view>
|
|
59
|
+
</view>
|
|
60
|
+
</view>
|
|
61
|
+
|
|
62
|
+
<view class="grid gap-3">
|
|
63
|
+
<view class="rounded-[24rpx] border border-slate-200 bg-white/70 p-4">
|
|
64
|
+
<view class="flex items-center justify-between gap-3">
|
|
65
|
+
<view class="font-semibold text-slate-800">
|
|
66
|
+
宿主背景
|
|
67
|
+
</view>
|
|
68
|
+
<view class="text-[22rpx] text-slate-400">
|
|
69
|
+
wx:bg-blue-500 not-wx:bg-red-500
|
|
70
|
+
</view>
|
|
71
|
+
</view>
|
|
72
|
+
<view class="mt-3 rounded-2xl px-3 py-2 text-sm font-medium text-white wx:bg-blue-500 not-wx:bg-red-500">
|
|
73
|
+
微信小程序为蓝色,不是微信小程序为红色。
|
|
74
|
+
</view>
|
|
75
|
+
</view>
|
|
76
|
+
|
|
77
|
+
<view class="rounded-[24rpx] border border-slate-200 bg-white/70 p-4">
|
|
78
|
+
<view class="flex items-center justify-between gap-3">
|
|
79
|
+
<view class="font-semibold text-slate-800">
|
|
80
|
+
文字强调
|
|
81
|
+
</view>
|
|
82
|
+
<view class="text-[22rpx] text-slate-400">
|
|
83
|
+
wx:text-white not-wx:text-slate-900
|
|
84
|
+
</view>
|
|
85
|
+
</view>
|
|
86
|
+
<view class="mt-3 rounded-2xl bg-slate-100 px-3 py-2 text-sm font-medium wx:bg-slate-900 wx:text-white not-wx:bg-rose-50 not-wx:text-slate-900">
|
|
87
|
+
微信小程序强调白字,其他端保留深色文字。
|
|
88
|
+
</view>
|
|
89
|
+
</view>
|
|
90
|
+
|
|
91
|
+
<view class="rounded-[24rpx] border border-slate-200 bg-white/70 p-4">
|
|
92
|
+
<view class="flex items-center justify-between gap-3">
|
|
93
|
+
<view class="font-semibold text-slate-800">
|
|
94
|
+
边框与阴影
|
|
95
|
+
</view>
|
|
96
|
+
<view class="text-[22rpx] text-slate-400">
|
|
97
|
+
wx:ring-2 not-wx:border
|
|
98
|
+
</view>
|
|
99
|
+
</view>
|
|
100
|
+
<view class="mt-3 rounded-2xl px-3 py-2 text-sm font-medium text-slate-700 wx:ring-2 wx:ring-blue-200 not-wx:border not-wx:border-rose-200 not-wx:bg-rose-50">
|
|
101
|
+
同一套标记在不同宿主呈现不同层次。
|
|
102
|
+
</view>
|
|
103
|
+
</view>
|
|
104
|
+
</view>
|
|
105
|
+
|
|
106
|
+
<view class="rounded-[24rpx] border border-slate-200/80 bg-white/60 p-4">
|
|
107
|
+
<view class="text-sm font-semibold text-slate-700">
|
|
108
|
+
页面里的实际写法
|
|
109
|
+
</view>
|
|
110
|
+
<view class="mt-2 grid gap-2 text-[24rpx] text-slate-600">
|
|
111
|
+
<view class="rounded-xl bg-slate-900/5 px-3 py-2">
|
|
112
|
+
wx:bg-blue-500 not-wx:bg-red-500
|
|
113
|
+
</view>
|
|
114
|
+
<view class="rounded-xl bg-slate-900/5 px-3 py-2">
|
|
115
|
+
wx:text-white not-wx:text-slate-900
|
|
116
|
+
</view>
|
|
117
|
+
<view class="rounded-xl bg-slate-900/5 px-3 py-2">
|
|
118
|
+
wx:ring-2 wx:ring-blue-200 not-wx:border not-wx:border-rose-200
|
|
119
|
+
</view>
|
|
120
|
+
</view>
|
|
121
|
+
</view>
|
|
122
|
+
</view>
|
|
123
|
+
|
|
124
|
+
<view
|
|
125
|
+
class="
|
|
126
|
+
mt-4 rounded-[24rpx] border border-slate-200/80 bg-white/60 p-4
|
|
127
|
+
shadow-inner
|
|
128
|
+
"
|
|
129
|
+
>
|
|
130
|
+
<view class="text-sm font-semibold text-slate-700">
|
|
131
|
+
更多文档
|
|
132
|
+
</view>
|
|
133
|
+
<view class="text-xs text-slate-500">
|
|
134
|
+
点击复制链接
|
|
135
|
+
</view>
|
|
136
|
+
<view class="mt-3 flex flex-wrap gap-2 text-xs">
|
|
137
|
+
<view
|
|
138
|
+
class="
|
|
139
|
+
rounded-full bg-slate-900/5 px-3 py-1 font-semibold text-slate-600
|
|
140
|
+
"
|
|
141
|
+
@click="copy('https://tw.icebreaker.top/')"
|
|
142
|
+
>
|
|
143
|
+
官网
|
|
144
|
+
</view>
|
|
145
|
+
<view
|
|
146
|
+
class="
|
|
147
|
+
rounded-full bg-slate-900/5 px-3 py-1 font-semibold text-slate-600
|
|
148
|
+
"
|
|
149
|
+
@click="copy('https://tw.icebreaker.top/docs/guide')"
|
|
150
|
+
>
|
|
151
|
+
Guide
|
|
152
|
+
</view>
|
|
153
|
+
</view>
|
|
154
|
+
</view>
|
|
155
|
+
</view>
|
|
156
|
+
</template>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as Pinia from 'pinia'
|
|
2
|
+
import { createSSRApp } from 'vue'
|
|
3
|
+
import App from './App.vue'
|
|
4
|
+
import './tailwind.css'
|
|
5
|
+
|
|
6
|
+
export function createApp() {
|
|
7
|
+
const app = createSSRApp(App)
|
|
8
|
+
app.use(Pinia.createPinia())
|
|
9
|
+
return {
|
|
10
|
+
app,
|
|
11
|
+
Pinia,
|
|
12
|
+
}
|
|
13
|
+
}
|