Commit 4cb3784f13fc516c6343798e8bf8a435e14d774c
1 parent
962f90de
feat: add search-list page
Showing
5 changed files
with
173 additions
and
3 deletions
src/locales/lang/zh_CN/routes/demo/page.ts
src/router/menus/modules/demo/page.ts
... | ... | @@ -107,12 +107,16 @@ const menu: MenuModule = { |
107 | 107 | children: [ |
108 | 108 | { |
109 | 109 | path: 'basic', |
110 | - name: '标准列表', | |
110 | + name: 'routes.demo.page.listBasic', | |
111 | 111 | }, |
112 | 112 | { |
113 | 113 | path: 'card', |
114 | 114 | name: 'routes.demo.page.listCard', |
115 | 115 | }, |
116 | + { | |
117 | + path: 'search', | |
118 | + name: 'routes.demo.page.listSearch', | |
119 | + }, | |
116 | 120 | ], |
117 | 121 | }, |
118 | 122 | ], | ... | ... |
src/router/routes/modules/demo/page.ts
... | ... | @@ -223,7 +223,7 @@ const page: AppRouteModule = { |
223 | 223 | name: 'ListBasicPage', |
224 | 224 | component: () => import('/@/views/demo/page/list/basic/index.vue'), |
225 | 225 | meta: { |
226 | - title: 'routes.demo.page.basic', | |
226 | + title: 'routes.demo.page.listBasic', | |
227 | 227 | }, |
228 | 228 | }, |
229 | 229 | { |
... | ... | @@ -234,6 +234,14 @@ const page: AppRouteModule = { |
234 | 234 | title: 'routes.demo.page.listCard', |
235 | 235 | }, |
236 | 236 | }, |
237 | + { | |
238 | + path: 'search', | |
239 | + name: 'ListSearchPage', | |
240 | + component: () => import('/@/views/demo/page/list/search/index.vue'), | |
241 | + meta: { | |
242 | + title: 'routes.demo.page.listSearch', | |
243 | + }, | |
244 | + }, | |
237 | 245 | ], |
238 | 246 | }, |
239 | 247 | // =============================list end============================= | ... | ... |
src/views/demo/page/list/search/data.tsx
0 → 100644
1 | +import { FormSchema } from '/@/components/Form/index'; | |
2 | + | |
3 | +export const searchList = (() => { | |
4 | + const result: any[] = []; | |
5 | + for (let i = 0; i < 6; i++) { | |
6 | + result.push({ | |
7 | + id: i, | |
8 | + title: 'Vben Admin', | |
9 | + description: ['Vben', '设计语言', 'Typescript'], | |
10 | + content: '基于Vue Next, TypeScript, Ant Design实现的一套完整的企业级后台管理系统。', | |
11 | + time: '2020-11-14 11:20', | |
12 | + }); | |
13 | + } | |
14 | + return result; | |
15 | +})(); | |
16 | + | |
17 | +export const actions: any[] = [ | |
18 | + { icon: 'ant-design:star-outlined', text: '156', color: '#018ffb' }, | |
19 | + { icon: 'ant-design:like-filled', text: '156', color: '#459ae8' }, | |
20 | + { icon: 'ant-design:message-filled', text: '2', color: '#42d27d' }, | |
21 | +]; | |
22 | + | |
23 | +export const schemas: FormSchema[] = [ | |
24 | + { | |
25 | + field: 'field1', | |
26 | + component: 'InputSearch', | |
27 | + label: '项目名', | |
28 | + colProps: { | |
29 | + span: 8, | |
30 | + }, | |
31 | + componentProps: { | |
32 | + onChange: (e: any) => { | |
33 | + console.log(e); | |
34 | + }, | |
35 | + }, | |
36 | + }, | |
37 | +]; | ... | ... |
src/views/demo/page/list/search/index.vue
0 → 100644
1 | +<template> | |
2 | + <div :class="prefixCls"> | |
3 | + <a-page-header title="搜索列表" :ghost="false" :class="`${prefixCls}__header`"> | |
4 | + <BasicForm | |
5 | + :class="`${prefixCls}__header-form`" | |
6 | + :labelWidth="100" | |
7 | + :schemas="schemas" | |
8 | + :showActionButtonGroup="false" | |
9 | + /> | |
10 | + </a-page-header> | |
11 | + | |
12 | + <div :class="`${prefixCls}__container`"> | |
13 | + <a-list> | |
14 | + <template v-for="item in list" :key="item.id"> | |
15 | + <a-list-item> | |
16 | + <a-list-item-meta> | |
17 | + <template #description> | |
18 | + <div :class="`${prefixCls}__content`">{{ item.content }}</div> | |
19 | + <div :class="`${prefixCls}__action`"> | |
20 | + <template v-for="(action, index) in actions" :key="index"> | |
21 | + <div :class="`${prefixCls}__action-item`"> | |
22 | + <Icon | |
23 | + v-if="action.icon" | |
24 | + :class="`${prefixCls}__action-icon`" | |
25 | + :icon="action.icon" | |
26 | + :color="action.color" | |
27 | + /> | |
28 | + {{ action.text }} | |
29 | + </div> | |
30 | + </template> | |
31 | + <span :class="`${prefixCls}__time`">{{ item.time }}</span> | |
32 | + </div> | |
33 | + </template> | |
34 | + <template #title> | |
35 | + <p :class="`${prefixCls}__title`"> {{ item.title }}</p> | |
36 | + <div> | |
37 | + <template v-for="(tag, index) in item.description" :key="index"> | |
38 | + <Tag class="mb-2">{{ tag }}</Tag> | |
39 | + </template> | |
40 | + </div> | |
41 | + </template> | |
42 | + </a-list-item-meta> | |
43 | + </a-list-item> | |
44 | + </template> | |
45 | + </a-list> | |
46 | + </div> | |
47 | + </div> | |
48 | +</template> | |
49 | +<script lang="ts"> | |
50 | + import { Tag } from 'ant-design-vue'; | |
51 | + import { defineComponent } from 'vue'; | |
52 | + import Icon from '/@/components/Icon/index'; | |
53 | + import { BasicForm } from '/@/components/Form/index'; | |
54 | + import { actions, searchList, schemas } from './data'; | |
55 | + | |
56 | + export default defineComponent({ | |
57 | + components: { Icon, Tag, BasicForm }, | |
58 | + setup() { | |
59 | + return { | |
60 | + prefixCls: 'list-search', | |
61 | + list: searchList, | |
62 | + actions, | |
63 | + schemas, | |
64 | + }; | |
65 | + }, | |
66 | + }); | |
67 | +</script> | |
68 | +<style lang="less" scoped> | |
69 | + .list-search { | |
70 | + &__header { | |
71 | + &-form { | |
72 | + margin-bottom: -16px; | |
73 | + } | |
74 | + } | |
75 | + | |
76 | + &__container { | |
77 | + padding: 12px; | |
78 | + margin: 24px; | |
79 | + background: #fff; | |
80 | + } | |
81 | + | |
82 | + &__title { | |
83 | + margin-bottom: 12px; | |
84 | + font-size: 18px; | |
85 | + } | |
86 | + | |
87 | + &__content { | |
88 | + color: rgba(0, 0, 0, 0.65); | |
89 | + } | |
90 | + | |
91 | + &__action { | |
92 | + margin-top: 10px; | |
93 | + | |
94 | + &-item { | |
95 | + display: inline-block; | |
96 | + padding: 0 16px; | |
97 | + color: rgba(0, 0, 0, 0.45); | |
98 | + | |
99 | + &:nth-child(1) { | |
100 | + padding-left: 0; | |
101 | + } | |
102 | + | |
103 | + &:nth-child(1), | |
104 | + &:nth-child(2) { | |
105 | + border-right: 1px solid rgba(206, 206, 206, 0.4); | |
106 | + } | |
107 | + } | |
108 | + | |
109 | + &-icon { | |
110 | + margin-right: 3px; | |
111 | + } | |
112 | + } | |
113 | + | |
114 | + &__time { | |
115 | + position: absolute; | |
116 | + right: 20px; | |
117 | + color: rgba(0, 0, 0, 0.45); | |
118 | + } | |
119 | + } | |
120 | +</style> | ... | ... |