/
4.vue
220 lines (202 loc) · 6.46 KB
/
4.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
<template>
<div class="drawer drawer-mobile bg-base-100">
<input id="my-drawer-2" type="checkbox" class="drawer-toggle" />
<div class="drawer-content flex justify-center lg:justify-start">
<div class="lg:w-[70vw] max-w-screen-lg">
<div class="navbar bg-base-100 lg:hidden sticky top-0 w-full z-50">
<div class="flex-none">
<label for="my-drawer-2" class="btn btn-square btn-ghost lg:hidden">
<span class="material-symbols-outlined"> menu_open </span>
</label>
</div>
<div class="flex-1">
<a class="btn btn-ghost capitalize text-xl">
{{ page.title }}
</a>
</div>
<div class="flex-none">
<button
v-for="item in ['dark_mode', 'menu_book', 'light_mode']"
:key="item"
data-set-theme="winter"
class="btn btn-sm btn-ghost btn-square"
data-act-class="btn-active"
>
<span
class="material-symbols-outlined !text-xl"
:style="iconFill"
v-html="item"
>
</span>
</button>
</div>
</div>
<div class="px-4 lg:pr-4">
<div class="space-y-6 mt-4">
<div
v-for="item in data"
:key="item.id"
class="card bg-base-200 shadow flex-col md:flex-row w-full"
>
<img
v-if="item.image.length > 0"
v-lazy="vLazy(item.image[0])"
:alt="item.title"
class="md:max-w-sm w-full"
/>
<div class="card-body">
<h2 class="card-title line-clamp-1">
{{ item.title }}
</h2>
<div class="justify-start">
<button
v-for="tag in item.tags"
:key="tag"
class="btn btn-xs mr-1"
:class="
$Mock.mock({
'array|1': allBtnType,
}).array
"
>
{{ tag }}
</button>
</div>
<p class="line-clamp-5 grow-0">
{{ item.paragraph }}
</p>
</div>
</div>
<div class="flex justify-center">
<div class="btn-group">
<button class="btn btn-active">1</button>
<button class="btn">2</button>
<button class="btn btn-disabled">...</button>
<button class="btn">99</button>
<button class="btn">100</button>
</div>
</div>
</div>
<div class="divider"></div>
<p class="text-sm pl-4">
© 1967 - 2022 <span class="capitalize">{{ page.title }}</span>
</p>
<p class="text-xs pl-4 pb-4">
<span class="capitalize">{{ page.title }}</span> theme desing by
<a class="link capitalize">{{ page.title }}</a>
</p>
</div>
</div>
</div>
<div class="drawer-side">
<label for="my-drawer-2" class="drawer-overlay"></label>
<div class="overflow-y-auto flex lg:justify-center w-fit lg:w-[30vw]">
<!-- Sidebar content here -->
<div class="w-72 p-3 lg:m-6 bg-base-100">
<div class="avatar w-full">
<div class="w-16 lg:w-32 rounded-full mx-auto">
<img v-lazy="vLazy(usePicsum('/128/128'))" />
</div>
</div>
<h1 class="text-2xl p-2 text-center capitalize">
{{ page.title }}
</h1>
<p class="text-sm text-center line-clamp-2 text-base-content/80">
{{ page.subtitle }}
</p>
<div class="flex gap-1 justify-center pt-4">
<a
v-for="item in templateContacts"
:key="item"
class="btn btn-sm btn-ghost btn-square"
v-html="item"
>
</a>
</div>
<div class="divider"></div>
<!-- menu start -->
<div class="pt-4">
<ul class="menu bg-base-100 rounded-box">
<li v-for="item in menu" :key="item">
<a class="capitalize">
<span class="material-symbols-outlined" v-html="item.icon">
</span>
{{ item.text }}
</a>
</li>
<div class="divider"></div>
<li class="hidden lg:block">
<div class="flex gap-1 justify-center">
<button
v-for="item in ['dark_mode', 'menu_book', 'light_mode']"
:key="item"
data-set-theme="winter"
class="btn btn-sm btn-ghost btn-square"
data-act-class="btn-active"
>
<span
class="material-symbols-outlined !text-xl"
:style="iconFill"
v-html="item"
>
</span>
</button>
</div>
</li>
</ul>
</div>
<!-- menu end -->
</div>
</div>
</div>
</div>
</template>
<script setup>
const route = useRoute();
const { $Mock } = useNuxtApp();
const data = ref();
const menu = ref([]);
const page = ref({});
watch(route, (v) => {
const { lang = "en" } = v.query;
init(lang);
});
onMounted(() => {
init(route.query.lang || "en");
});
const init = (lang) => {
page.value = {
en: {
title: $Mock.mock("@first") + " blog",
subtitle: $Mock.mock("@sentence"),
},
zh: {
title: $Mock.mock("@cname"),
subtitle: $Mock.mock("@csentence"),
},
}[lang];
data.value = $Mock.mock({
"en|4-15": [
{
"id|+1": 1,
title: "@title",
paragraph: "@paragraph(1,5)",
"tags|1-5": ["@word"],
"image|0-1": () =>
$Mock.Random.boolean() ? [`${usePicsum("/400/300")}`] : [],
},
],
"zh|4-15": [
{
"id|+1": 1,
title: "@ctitle",
paragraph: "@cparagraph(3, 20)",
"tags|1-5": ["@cword(2,5)"],
"image|0-1": () =>
$Mock.Random.boolean() ? [`${usePicsum("/400/300")}`] : [],
},
],
})[lang];
menu.value = $MockKeywords()[lang].menu;
};
</script>