3
3
<div v-for =" item in list" >
4
4
<h3 >{{item.title}}</h3>
5
5
<div class =" list" >
6
- <div v-for =" sub in item.data" class =" sub" :style =" {background: `url(${sub.img}) no-repeat`, backgroundSize: '100%'}" >
7
- <div class =" title" >{{sub.title}}</div>
8
- </div>
6
+ <a v-for =" (sub, inx) in item.data" :href =" sub.link" _target =" blank" class =" sub" :class =" {nomargin: (inx+1)%3===0}" >
7
+ <div v-if =" sub.img" class =" cover" :style =" {background: `url(${sub.img}) no-repeat`, backgroundSize: '100%'}" >
8
+ <div class =" labels" v-if =" sub.labels" >
9
+ <span v-for =" label in sub.labels" >{{label}}</span>
10
+ </div>
11
+ </div>
12
+ <div v-else class =" cover" :style =" {background: bgColors[Math.floor(Math.random() * bgColors.length)]}" >
13
+ {{sub.title}}
14
+ <div class =" labels" v-if =" sub.labels" >
15
+ <span v-for =" label in sub.labels" >{{label}}</span>
16
+ </div>
17
+ </div>
18
+ <div class =" desc" >{{sub.desc}}</div>
19
+ </a>
9
20
</div>
10
21
</div>
11
22
</div>
14
25
<script >
15
26
const list = [
16
27
{
17
- title: ' 官方推荐库 ' ,
28
+ title: ' 配套项目 ' ,
18
29
data: [
19
30
{
20
- desc: ' ' ,
21
- img: ' http://static.vue-js.com/feef6400-bc18-11ea-9a81-55f6f6d89e24.png' ,
22
- title: ' Vue Router'
31
+ desc: ' Vue3设计理念,动机与目的,上手必读' ,
32
+ img: ' ' ,
33
+ title: ' Vue3设计理念' ,
34
+ link: ' http://vue3js.cn/vue-composition/'
23
35
},
24
36
{
25
- desc: ' ' ,
26
- img: ' http://static.vue-js.com/cbdf2fa0-bc18-11ea-9a81-55f6f6d89e24.png' ,
27
- title: ' Vuex'
37
+ desc: ' Vue3 Api 参考' ,
38
+ img: ' ' ,
39
+ title: ' Vue3 Api' ,
40
+ link: ' http://vue3js.cn/vue-composition-api/'
28
41
},
29
42
{
30
43
desc: ' ' ,
31
- img: ' http://static.vue-js.com/2c3c6020-bc19-11ea-9a81-55f6f6d89e24.png' ,
32
- title: ' Axios'
44
+ img: ' ' ,
45
+ title: ' Vue3源码加速筹备中' ,
46
+ // link: 'http://vue3js.cn/vue-composition-api/'
47
+ },
48
+ ]
49
+ },
50
+ {
51
+ title: ' 配套项目' ,
52
+ data: [
53
+ {
54
+ desc: ' 看文档看文档看文档,重要的事情说三遍' ,
55
+ img: ' ' ,
56
+ title: ' Vue文档' ,
57
+ link: ' https://doc.vue-js.com/v2/api/'
58
+ },
59
+ {
60
+ desc: ' Vue Router 是 Vue.js 官方的路由管理器。它和 Vue.js 的核心深度集成,让构建单页面应用变得易如反掌' ,
61
+ img: ' ' ,
62
+ title: ' Vue Router' ,
63
+ link: ' https://router.vuejs.org/zh/'
64
+ },
65
+ {
66
+ desc: ' Vue复杂数据管理的最好方式' ,
67
+ img: ' ' ,
68
+ title: ' Vuex' ,
69
+ link: ' https://vuex.vuejs.org/zh/guide/'
70
+ },
71
+ {
72
+ desc: ' 易用、简洁且高效的http库, 在Vue项目大量使用, 使用Promise管理异步,告别传统callback方式' ,
73
+ img: ' ' ,
74
+ title: ' Axios' ,
75
+ link: ' https://github.com/axios/axios'
76
+ },
77
+ {
78
+ desc: ' 🛠️ Vue.js 开发的标准工具' ,
79
+ img: ' ' ,
80
+ title: ' Vue Cli' ,
81
+ link: ' https://cli.vuejs.org/zh/'
82
+ },
83
+ {
84
+ desc: ' 基于 Vue 前端开发框架的静态站点生成工具, SEO必备良器' ,
85
+ img: ' ' ,
86
+ title: ' Nuxt' ,
87
+ link: ' https://www.nuxtjs.cn/'
88
+ },
89
+ {
90
+ desc: ' VuePress静态站点搭建首选' ,
91
+ img: ' ' ,
92
+ title: ' VuePress' ,
93
+ link: ' https://vue-js.com/vuepress/zh/'
94
+ },
95
+ {
96
+ desc: ' 逐行剖析 Vue.js 源码九大模块,逐个击破' ,
97
+ img: ' ' ,
98
+ title: ' Vue源码导读' ,
99
+ link: ' https://vue-js.com/learn-vue/'
100
+ },
101
+ ]
102
+ },
103
+ {
104
+ title: ' 开源UI库' ,
105
+ data: [
106
+ {
107
+ desc: ' 饿了么出品的Vue2的web UI工具套件' ,
108
+ img: ' ' ,
109
+ title: ' Element' ,
110
+ labels: [' PC端' , ' TB风格' ],
111
+ link: ' https://element.eleme.io/#/'
112
+ },
113
+ {
114
+ desc: ' 基于Vue和WeUI的移动组件库' ,
115
+ img: ' ' ,
116
+ title: ' Vux' ,
117
+ labels: [' 移动端' , ' 微信风格' ],
118
+ link: ' https://github.com/airyland/vux'
119
+ },
120
+ {
121
+ desc: ' 基于Vuejs的开源 UI 组件库' ,
122
+ img: ' ' ,
123
+ title: ' iview' ,
124
+ labels: [' 移动端' ],
125
+ link: ' https://github.com/iview/iview'
126
+ },
127
+ {
128
+ desc: ' 三端样式一致的响应式 UI 库' ,
129
+ img: ' ' ,
130
+ title: ' Muse-ui' ,
131
+ labels: [' 响应式' , ' 多端' ],
132
+ link: ' https://muse-ui.org/'
133
+ },
134
+ {
135
+ desc: ' 通过Vue Material和Vue 2建立精美的app应用' ,
136
+ img: ' ' ,
137
+ title: ' Vue-material' ,
138
+ labels: [' Material风格' ],
139
+ link: ' http://vuematerial.materializecss.cn/'
140
+ },
141
+ {
142
+ desc: ' 应用于Vuejs2的Twitter的Bootstrap 4组件' ,
143
+ img: ' ' ,
144
+ title: ' Bootstrap-vue' ,
145
+ labels: [' Bootstrap风格' , ' 情怀' ],
146
+ link: ' https://bootstrap-vue.org/'
147
+ },
148
+ {
149
+ desc: ' 为移动而生的Vue JS 2组件框架' ,
150
+ img: ' ' ,
151
+ title: ' Vuetify' ,
152
+ labels: [' 移动端' ],
153
+ link: ' https://vuetifyjs.com/zh-Hans/getting-started/quick-start/'
154
+ }
155
+ ]
156
+ },
157
+ {
158
+ title: ' 优秀实战项目' ,
159
+ data: [
160
+ {
161
+ desc: ' 基于 vue2 + vuex 构建一个具有 45 个页面的大型单页面应用' ,
162
+ img: ' ' ,
163
+ title: ' Vue饿了么' ,
164
+ link: ' https://github.com/bailicangdu/vue2-elm'
165
+ },
166
+ {
167
+ desc: ' vue管理后台模板' ,
168
+ img: ' ' ,
169
+ title: ' vue-element-admin' ,
170
+ link: ' https://github.com/PanJiaChen/vue-element-admin'
171
+ },
172
+ {
173
+ desc: ' Vue饿了么配套的管理后台' ,
174
+ img: ' ' ,
175
+ title: ' vue2-manage' ,
176
+ link: ' https://github.com/bailicangdu/vue2-manage'
177
+ },
178
+ {
179
+ desc: ' 基于Vue的个人音频流媒体服务' ,
180
+ img: ' ' ,
181
+ title: ' koel' ,
182
+ link: ' https://github.com/koel/koel'
183
+ },
184
+ {
185
+ desc: ' 高仿网易云音乐的webapp' ,
186
+ img: ' ' ,
187
+ title: ' NeteaseCloudWebApp' ,
188
+ link: ' https://github.com/javaSwing/NeteaseCloudWebApp'
189
+ },
190
+ {
191
+ desc: ' 全栈式开发bilibili首页' ,
192
+ img: ' ' ,
193
+ title: ' bilibili-vue' ,
194
+ link: ' https://github.com/lybenson/bilibili-vue'
33
195
},
34
196
]
35
197
}
36
198
]
199
+ const bgColors = [' #81348e' , ' #3eaf7c' , ' #92af3e' , ' #af7e3e' , ' #af593e' , ' #3ea8af' , ' #af3e3e' ]
37
200
export default {
38
201
name: ' Card' ,
39
202
props: {
@@ -44,7 +207,8 @@ export default {
44
207
},
45
208
data (){
46
209
return {
47
- list
210
+ list,
211
+ bgColors
48
212
}
49
213
},
50
214
methods: {
@@ -54,15 +218,76 @@ export default {
54
218
</script >
55
219
56
220
<style scoped>
221
+ * {
222
+ box-sizing : border-box ;
223
+ }
57
224
.main {
58
225
width : 100% ;
59
226
}
60
227
.list {
61
228
display : flex ;
229
+ /* justify-content: space-around; */
230
+ flex-wrap : wrap ;
62
231
}
63
232
.sub {
64
- flex : 0 0 30% ;
65
- height : 200px ;
66
- background-size : 100% ;
233
+ flex : 0 0 32% ;
234
+ /* height: 200px; */
235
+ position : relative ;
236
+
237
+ cursor : pointer ;
238
+ margin-right : 2% ;
239
+ margin-bottom : 2% ;
240
+ }
241
+ @media (max-width : 750px ) {
242
+ .sub {
243
+ flex : 0 0 100% ;
244
+ }
245
+ }
246
+ .sub.nomargin {
247
+ margin-right : 0 ;
248
+ }
249
+ .sub .cover {
250
+ position : relative ;
251
+ height : 120px ;
252
+ background : #fbfbfb ;
253
+ /* border: 1px solid hsla(0,0%,80%,.569); */
254
+ border-radius : 5px ;
255
+ font-size : 24px ;
256
+ text-align : center ;
257
+ line-height : 120px ;
258
+ color : #fff ;
259
+ transition : all .2s ease-in-out ;
260
+ }
261
+ .sub .cover :hover {
262
+ box-shadow : 0 18px 32px -18px #000 !important ;
263
+ transform : translateY (-3px );
264
+ }
265
+ .sub .desc {
266
+ /* position: absolute; */
267
+ width : 100% ;
268
+ color : #333 ;
269
+ /* text-shadow: 0 2px 4px rgba(7,17,27,.5); */
270
+ /* font-weight: 700; */
271
+ /* background: rgba(28,31,33,.6); */
272
+ /* bottom: 0; */
273
+ line-height : 28px ;
274
+ padding : 5px 8px ;
275
+ }
276
+ .sub .labels {
277
+ position : absolute ;
278
+ bottom : 0 ;
279
+ display : flex ;
280
+ line-height : 16px ;
281
+ font-size : 12px ;
282
+ padding : 5px ;
283
+ }
284
+ .sub .labels span {
285
+ padding : 3px 5px ;
286
+ background : rgba (0 , 0 , 0 , .5 );
287
+ color : #fff ;
288
+ display : inline-block ;
289
+ margin-right : 5px ;
290
+ border-radius : 4px ;
291
+ zoom : .8 ;
67
292
}
68
293
</style >
0 commit comments