af-mobile-client-vue3 1.1.4 → 1.1.6
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/build/vite/index.ts +105 -91
- package/package.json +3 -1
- package/src/components/core/Uploader/index.vue +2 -2
- package/src/components/data/XFormItem/index.vue +47 -12
- package/src/components/data/XOlMap/index.vue +1 -1
- package/src/router/routes.ts +6 -0
- package/src/views/component/IconifyView/index.vue +507 -0
- package/src/views/component/XOlMapView/XLocationPicker/index.vue +2 -2
- package/src/views/component/index.vue +4 -0
package/build/vite/index.ts
CHANGED
|
@@ -1,91 +1,105 @@
|
|
|
1
|
-
import path from 'node:path'
|
|
2
|
-
import process from 'node:process'
|
|
3
|
-
import legacy from '@vitejs/plugin-legacy'
|
|
4
|
-
import vue from '@vitejs/plugin-vue'
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
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
|
-
symbolId
|
|
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
|
-
|
|
1
|
+
import path from 'node:path'
|
|
2
|
+
import process from 'node:process'
|
|
3
|
+
import legacy from '@vitejs/plugin-legacy'
|
|
4
|
+
import vue from '@vitejs/plugin-vue'
|
|
5
|
+
import { presetIcons } from 'unocss'
|
|
6
|
+
import UnoCSS from 'unocss/vite'
|
|
7
|
+
import viteCompression from 'vite-plugin-compression'
|
|
8
|
+
import mockDevServerPlugin from 'vite-plugin-mock-dev-server'
|
|
9
|
+
import { VitePWA } from 'vite-plugin-pwa'
|
|
10
|
+
import Sitemap from 'vite-plugin-sitemap'
|
|
11
|
+
import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
|
|
12
|
+
import { createViteVConsole } from './vconsole'
|
|
13
|
+
|
|
14
|
+
export function createVitePlugins() {
|
|
15
|
+
const root = process.cwd()
|
|
16
|
+
|
|
17
|
+
return [
|
|
18
|
+
vue({
|
|
19
|
+
template: {
|
|
20
|
+
compilerOptions: {
|
|
21
|
+
// 注册自定义组件micro-app 防止控制台警告
|
|
22
|
+
isCustomElement: tag => tag.startsWith('micro-app'),
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
}),
|
|
26
|
+
|
|
27
|
+
// https://github.com/jbaubree/vite-plugin-sitemap
|
|
28
|
+
Sitemap(),
|
|
29
|
+
|
|
30
|
+
// https://github.com/pengzhanbo/vite-plugin-mock-dev-server
|
|
31
|
+
mockDevServerPlugin(),
|
|
32
|
+
|
|
33
|
+
// svg icon
|
|
34
|
+
createSvgIconsPlugin({
|
|
35
|
+
// 指定图标文件夹
|
|
36
|
+
iconDirs: [path.resolve(root, 'src/icons/svg')],
|
|
37
|
+
// 指定 symbolId 格式
|
|
38
|
+
symbolId: 'icon-[dir]-[name]',
|
|
39
|
+
}),
|
|
40
|
+
|
|
41
|
+
// 生产环境 gzip 压缩资源
|
|
42
|
+
viteCompression({
|
|
43
|
+
algorithm: 'gzip',
|
|
44
|
+
// 文件大于10240b(10kb)时才压缩文件
|
|
45
|
+
threshold: 10240,
|
|
46
|
+
// 禁止在控制台输出压缩结果
|
|
47
|
+
verbose: false,
|
|
48
|
+
// 压缩完文件后删除源文件
|
|
49
|
+
deleteOriginFile: false,
|
|
50
|
+
}),
|
|
51
|
+
|
|
52
|
+
legacy({
|
|
53
|
+
targets: ['defaults', 'not IE 11'],
|
|
54
|
+
}),
|
|
55
|
+
|
|
56
|
+
// https://github.com/antfu/unocss
|
|
57
|
+
// see uno.config.ts for config
|
|
58
|
+
UnoCSS({
|
|
59
|
+
presets: [
|
|
60
|
+
presetIcons({
|
|
61
|
+
scale: 1.2,
|
|
62
|
+
warn: true,
|
|
63
|
+
extraProperties: {
|
|
64
|
+
'display': 'inline-block',
|
|
65
|
+
'vertical-align': 'middle',
|
|
66
|
+
'width': 'var(--van-font-size-md)',
|
|
67
|
+
'height': 'var(--van-font-size-md)',
|
|
68
|
+
},
|
|
69
|
+
}),
|
|
70
|
+
],
|
|
71
|
+
}),
|
|
72
|
+
|
|
73
|
+
// https://github.com/vadxq/vite-plugin-vconsole
|
|
74
|
+
createViteVConsole(),
|
|
75
|
+
|
|
76
|
+
// https://github.com/antfu/vite-plugin-pwa
|
|
77
|
+
VitePWA({
|
|
78
|
+
registerType: 'autoUpdate',
|
|
79
|
+
includeAssets: ['favicon.svg', 'safari-pinned-tab.svg'],
|
|
80
|
+
manifest: {
|
|
81
|
+
name: 'af-mobile-client-vue3',
|
|
82
|
+
short_name: 'af-mobile-client-vue3',
|
|
83
|
+
theme_color: '#ffffff',
|
|
84
|
+
icons: [
|
|
85
|
+
{
|
|
86
|
+
src: '/pwa-192x192.png',
|
|
87
|
+
sizes: '192x192',
|
|
88
|
+
type: 'image/png',
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
src: '/pwa-512x512.png',
|
|
92
|
+
sizes: '512x512',
|
|
93
|
+
type: 'image/png',
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
src: '/pwa-512x512.png',
|
|
97
|
+
sizes: '512x512',
|
|
98
|
+
type: 'image/png',
|
|
99
|
+
purpose: 'any maskable',
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
}),
|
|
104
|
+
]
|
|
105
|
+
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "af-mobile-client-vue3",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.6",
|
|
5
5
|
"description": "Vue + Vite component lib",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
@@ -25,6 +25,7 @@
|
|
|
25
25
|
"@vant/touch-emulator": "^1.4.0",
|
|
26
26
|
"@vant/use": "^1.6.0",
|
|
27
27
|
"@vueuse/core": "^13.1.0",
|
|
28
|
+
"@iconify/vue": "4.3.0",
|
|
28
29
|
"animate.css": "^4.1.1",
|
|
29
30
|
"axios": "^1.8.4",
|
|
30
31
|
"crypto-js": "^4.2.0",
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
},
|
|
45
46
|
"devDependencies": {
|
|
46
47
|
"@antfu/eslint-config": "^4.12.0",
|
|
48
|
+
"@iconify/json": "2.2.318",
|
|
47
49
|
"@types/crypto-js": "^4.2.2",
|
|
48
50
|
"@types/lodash-es": "^4.17.12",
|
|
49
51
|
"@types/node": "^22.14.1",
|
|
@@ -79,8 +79,8 @@ function deleteFileFunction(file: any) {
|
|
|
79
79
|
// ------------------------- 初始化 -------------------------
|
|
80
80
|
|
|
81
81
|
function initComponent() {
|
|
82
|
-
if (props
|
|
83
|
-
imageList.value = props
|
|
82
|
+
if (props?.imageList?.length > 0) {
|
|
83
|
+
imageList.value = props?.imageList.map((item) => {
|
|
84
84
|
return { id: item.id, name: item.f_filename, url: item.f_downloadpath }
|
|
85
85
|
})
|
|
86
86
|
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
+
import type { FieldType } from 'vant'
|
|
2
3
|
import type { Numeric } from 'vant/es/utils'
|
|
4
|
+
import type { LocationResult } from '../XOlMap/types'
|
|
3
5
|
import Uploader from '@af-mobile-client-vue3/components/core/Uploader/index.vue'
|
|
4
6
|
import XGridDropOption from '@af-mobile-client-vue3/components/core/XGridDropOption/index.vue'
|
|
5
7
|
import XMultiSelect from '@af-mobile-client-vue3/components/core/XMultiSelect/index.vue'
|
|
6
8
|
import XSelect from '@af-mobile-client-vue3/components/core/XSelect/index.vue'
|
|
9
|
+
import XLocationPicker from '@af-mobile-client-vue3/components/data/XOlMap/XLocationPicker/index.vue'
|
|
7
10
|
import { runLogic } from '@af-mobile-client-vue3/services/api/common'
|
|
8
11
|
import { searchToListOption, searchToOption } from '@af-mobile-client-vue3/services/v3Api'
|
|
9
12
|
import { useUserStore } from '@af-mobile-client-vue3/stores/modules/user'
|
|
@@ -144,13 +147,9 @@ const showFormItemFunc = debounce(async () => {
|
|
|
144
147
|
|
|
145
148
|
const localValue = computed({
|
|
146
149
|
get() {
|
|
147
|
-
// if (props.modelValue !== undefined) {
|
|
148
|
-
// return props.modelValue
|
|
149
|
-
// }
|
|
150
150
|
switch (attr.type) {
|
|
151
151
|
case 'uploader':
|
|
152
152
|
if (mode === '查询') {
|
|
153
|
-
// console.log(querySelectDefaultValue.value)
|
|
154
153
|
return props.modelValue !== undefined ? props.modelValue : querySelectDefaultValue.value
|
|
155
154
|
}
|
|
156
155
|
else {
|
|
@@ -510,7 +509,7 @@ function onPickerConfirm({ selectedOptions }) {
|
|
|
510
509
|
// 日期时间选择数据
|
|
511
510
|
const dateTimePickerValue = ref(undefined)
|
|
512
511
|
function showDataTimePicker() {
|
|
513
|
-
if (props.modelValue !== undefined && props.modelValue !== '' && props.modelValue !== null) {
|
|
512
|
+
if (props.modelValue !== undefined && props.modelValue !== '' && props.modelValue !== null && typeof props.modelValue === 'string') {
|
|
514
513
|
// 拆分日期和时间
|
|
515
514
|
const [dateStr, timeStr] = props.modelValue.split(' ')
|
|
516
515
|
// 拆分日期部分
|
|
@@ -587,6 +586,14 @@ function onDateTimePickerConfirm() {
|
|
|
587
586
|
function onPickerCancel() {
|
|
588
587
|
showDatePicker.value = false
|
|
589
588
|
}
|
|
589
|
+
|
|
590
|
+
const showAddressPicker = ref(false)
|
|
591
|
+
const addressValue = ref('')
|
|
592
|
+
// 处理地址选择器确认
|
|
593
|
+
function handleAddressConfirm(location) {
|
|
594
|
+
addressValue.value = location.address
|
|
595
|
+
showAddressPicker.value = false
|
|
596
|
+
}
|
|
590
597
|
</script>
|
|
591
598
|
|
|
592
599
|
<template>
|
|
@@ -843,11 +850,11 @@ function onPickerCancel() {
|
|
|
843
850
|
>
|
|
844
851
|
<VanDatePicker
|
|
845
852
|
v-model="dateTimePickerValue.date"
|
|
846
|
-
:columns-type="attr.
|
|
853
|
+
:columns-type="attr.dateColumnsType || ['year', 'month', 'day']"
|
|
847
854
|
/>
|
|
848
855
|
<VanTimePicker
|
|
849
856
|
v-model="dateTimePickerValue.time"
|
|
850
|
-
:columns-type="['hour', 'minute', 'second']"
|
|
857
|
+
:columns-type="attr.timeColumnsType || ['hour', 'minute', 'second']"
|
|
851
858
|
:min-time="attr.minTime ? attr.minTime : '00:00:00'"
|
|
852
859
|
:max-time="attr.maxTime ? attr.maxTime : '23:59:59'"
|
|
853
860
|
/>
|
|
@@ -880,15 +887,13 @@ function onPickerCancel() {
|
|
|
880
887
|
>
|
|
881
888
|
<VanDatePicker
|
|
882
889
|
v-model="dateTimePickerValue.date"
|
|
883
|
-
:columns-type="attr.
|
|
884
|
-
:readonly="attr.readonly ? attr.readonly : false"
|
|
890
|
+
:columns-type="attr.dateColumnsType || ['year', 'month', 'day']"
|
|
885
891
|
/>
|
|
886
892
|
<VanTimePicker
|
|
887
893
|
v-model="dateTimePickerValue.time"
|
|
888
|
-
:columns-type="['hour', 'minute', 'second']"
|
|
894
|
+
:columns-type="attr.timeColumnsType || ['hour', 'minute', 'second']"
|
|
889
895
|
:min-time="attr.minTime ? attr.minTime : '00:00:00'"
|
|
890
896
|
:max-time="attr.maxTime ? attr.maxTime : '23:59:59'"
|
|
891
|
-
:readonly="attr.readonly ? attr.readonly : false"
|
|
892
897
|
/>
|
|
893
898
|
</VanPickerGroup>
|
|
894
899
|
</VanPopup>
|
|
@@ -979,7 +984,7 @@ function onPickerCancel() {
|
|
|
979
984
|
:label="labelData"
|
|
980
985
|
:label-align="labelAlign"
|
|
981
986
|
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
982
|
-
:type="attr.type"
|
|
987
|
+
:type="attr.type as FieldType"
|
|
983
988
|
:readonly="readonly"
|
|
984
989
|
:disabled="attr.disabled"
|
|
985
990
|
:placeholder="placeholder"
|
|
@@ -988,6 +993,36 @@ function onPickerCancel() {
|
|
|
988
993
|
:rules="[{ required: attr.rule.required === 'true', message: `请填写${attr.name}` }]"
|
|
989
994
|
@blur="() => formTypeCheck(attr, localValue as string)"
|
|
990
995
|
/>
|
|
996
|
+
|
|
997
|
+
<!-- 地址选择器 -->
|
|
998
|
+
<VanField
|
|
999
|
+
v-if="attr.type === 'addressSearch' && showItem"
|
|
1000
|
+
v-model="addressValue"
|
|
1001
|
+
name="addressSearch"
|
|
1002
|
+
:label="labelData"
|
|
1003
|
+
:label-align="labelAlign"
|
|
1004
|
+
:input-align="attr.inputAlign ? attr.inputAlign : 'left'"
|
|
1005
|
+
readonly
|
|
1006
|
+
is-link
|
|
1007
|
+
:placeholder="placeholder"
|
|
1008
|
+
:rules="[{ required: attr.rule.required === 'true', message: '请选择地址' }]"
|
|
1009
|
+
@click="readonly ? null : showAddressPicker = true"
|
|
1010
|
+
/>
|
|
1011
|
+
<VanPopup
|
|
1012
|
+
v-model:show="showAddressPicker"
|
|
1013
|
+
position="bottom"
|
|
1014
|
+
:style="{ height: '80vh' }"
|
|
1015
|
+
teleport="body"
|
|
1016
|
+
>
|
|
1017
|
+
<XLocationPicker
|
|
1018
|
+
v-model="localValue as LocationResult"
|
|
1019
|
+
tian-di-tu-key="c16876b28898637c0a1a68b3fa410504"
|
|
1020
|
+
amap-key="5ebabc4536d4b42e0dd1e20175cca8ab"
|
|
1021
|
+
:default-center="[108.948024, 34.263161]"
|
|
1022
|
+
:default-zoom="12"
|
|
1023
|
+
@confirm="handleAddressConfirm"
|
|
1024
|
+
/>
|
|
1025
|
+
</VanPopup>
|
|
991
1026
|
</div>
|
|
992
1027
|
</template>
|
|
993
1028
|
|
package/src/router/routes.ts
CHANGED
|
@@ -6,6 +6,7 @@ import PageLayout from '@af-mobile-client-vue3/layout/PageLayout.vue'
|
|
|
6
6
|
import SingleLayout from '@af-mobile-client-vue3/layout/SingleLayout.vue'
|
|
7
7
|
import NotFound from '@af-mobile-client-vue3/views/common/NotFound.vue'
|
|
8
8
|
import EvaluateRecordView from '@af-mobile-client-vue3/views/component/EvaluateRecordView/index.vue'
|
|
9
|
+
import IconifyView from '@af-mobile-client-vue3/views/component/IconifyView/index.vue'
|
|
9
10
|
import ComponentView from '@af-mobile-client-vue3/views/component/index.vue'
|
|
10
11
|
import XCellDetailView from '@af-mobile-client-vue3/views/component/XCellDetailView/index.vue'
|
|
11
12
|
import XCellListView from '@af-mobile-client-vue3/views/component/XCellListView/index.vue'
|
|
@@ -140,6 +141,11 @@ const routes: Array<RouteRecordRaw> = [
|
|
|
140
141
|
name: 'XRequestView',
|
|
141
142
|
component: XRequestView,
|
|
142
143
|
},
|
|
144
|
+
{
|
|
145
|
+
path: '/Component/IconifyView',
|
|
146
|
+
name: 'IconifyView',
|
|
147
|
+
component: IconifyView,
|
|
148
|
+
},
|
|
143
149
|
],
|
|
144
150
|
},
|
|
145
151
|
{
|
|
@@ -0,0 +1,507 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { Icon } from '@iconify/vue'
|
|
3
|
+
import {
|
|
4
|
+
Cell as VanCell,
|
|
5
|
+
CellGroup as VanCellGroup,
|
|
6
|
+
Col as VanCol,
|
|
7
|
+
Divider as VanDivider,
|
|
8
|
+
Field as VanField,
|
|
9
|
+
Grid as VanGrid,
|
|
10
|
+
GridItem as VanGridItem,
|
|
11
|
+
NavBar as VanNavBar,
|
|
12
|
+
Row as VanRow,
|
|
13
|
+
Tab as VanTab,
|
|
14
|
+
Tabs as VanTabs,
|
|
15
|
+
} from 'vant'
|
|
16
|
+
import { computed, ref } from 'vue'
|
|
17
|
+
import { useRouter } from 'vue-router'
|
|
18
|
+
|
|
19
|
+
const router = useRouter()
|
|
20
|
+
const searchKeyword = ref('')
|
|
21
|
+
const activeTab = ref(0)
|
|
22
|
+
|
|
23
|
+
// 图标分类展示
|
|
24
|
+
const iconCategories = [
|
|
25
|
+
{
|
|
26
|
+
title: '常用图标',
|
|
27
|
+
icons: [
|
|
28
|
+
{ name: 'mdi:home', label: '首页' },
|
|
29
|
+
{ name: 'mdi:account', label: '用户' },
|
|
30
|
+
{ name: 'mdi:bell', label: '通知' },
|
|
31
|
+
{ name: 'mdi:cog', label: '设置' },
|
|
32
|
+
{ name: 'mdi:magnify', label: '搜索' },
|
|
33
|
+
{ name: 'mdi:plus', label: '添加' },
|
|
34
|
+
{ name: 'mdi:check', label: '确认' },
|
|
35
|
+
{ name: 'mdi:close', label: '关闭' },
|
|
36
|
+
],
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: '方向图标',
|
|
40
|
+
icons: [
|
|
41
|
+
{ name: 'mdi:arrow-up', label: '向上' },
|
|
42
|
+
{ name: 'mdi:arrow-right', label: '向右' },
|
|
43
|
+
{ name: 'mdi:arrow-down', label: '向下' },
|
|
44
|
+
{ name: 'mdi:arrow-left', label: '向左' },
|
|
45
|
+
{ name: 'mdi:chevron-up', label: '上箭头' },
|
|
46
|
+
{ name: 'mdi:chevron-right', label: '右箭头' },
|
|
47
|
+
{ name: 'mdi:chevron-down', label: '下箭头' },
|
|
48
|
+
{ name: 'mdi:chevron-left', label: '左箭头' },
|
|
49
|
+
],
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
title: '文件图标',
|
|
53
|
+
icons: [
|
|
54
|
+
{ name: 'mdi:file', label: '文件' },
|
|
55
|
+
{ name: 'mdi:file-document', label: '文档' },
|
|
56
|
+
{ name: 'mdi:file-excel', label: 'Excel' },
|
|
57
|
+
{ name: 'mdi:file-pdf', label: 'PDF' },
|
|
58
|
+
{ name: 'mdi:file-image', label: '图片' },
|
|
59
|
+
{ name: 'mdi:file-video', label: '视频' },
|
|
60
|
+
{ name: 'mdi:file-music', label: '音频' },
|
|
61
|
+
{ name: 'mdi:folder', label: '文件夹' },
|
|
62
|
+
],
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
title: '通信图标',
|
|
66
|
+
icons: [
|
|
67
|
+
{ name: 'mdi:email', label: '邮件' },
|
|
68
|
+
{ name: 'mdi:phone', label: '电话' },
|
|
69
|
+
{ name: 'mdi:message', label: '消息' },
|
|
70
|
+
{ name: 'mdi:chat', label: '聊天' },
|
|
71
|
+
{ name: 'mdi:wifi', label: 'WiFi' },
|
|
72
|
+
{ name: 'mdi:bluetooth', label: '蓝牙' },
|
|
73
|
+
{ name: 'mdi:share', label: '分享' },
|
|
74
|
+
{ name: 'mdi:cloud', label: '云' },
|
|
75
|
+
],
|
|
76
|
+
},
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
// UnoCSS图标示例
|
|
80
|
+
const unocssIcons = [
|
|
81
|
+
{ name: 'i-mdi:home', label: '首页' },
|
|
82
|
+
{ name: 'i-mdi:account', label: '用户' },
|
|
83
|
+
{ name: 'i-mdi:bell', label: '通知' },
|
|
84
|
+
{ name: 'i-mdi:cog', label: '设置' },
|
|
85
|
+
{ name: 'i-mdi:magnify', label: '搜索' },
|
|
86
|
+
{ name: 'i-mdi:plus', label: '添加' },
|
|
87
|
+
{ name: 'i-mdi:check', label: '确认' },
|
|
88
|
+
{ name: 'i-mdi:close', label: '关闭' },
|
|
89
|
+
{ name: 'i-mdi:arrow-up', label: '向上' },
|
|
90
|
+
{ name: 'i-mdi:arrow-right', label: '向右' },
|
|
91
|
+
{ name: 'i-mdi:arrow-down', label: '向下' },
|
|
92
|
+
{ name: 'i-mdi:arrow-left', label: '向左' },
|
|
93
|
+
]
|
|
94
|
+
|
|
95
|
+
// 样式设置示例
|
|
96
|
+
const styleExamples = [
|
|
97
|
+
{ name: 'mdi:home', label: '默认样式', style: {} },
|
|
98
|
+
{ name: 'mdi:home', label: '大尺寸', style: { fontSize: '32px' } },
|
|
99
|
+
{ name: 'mdi:home', label: '自定义颜色', style: { color: '#1989fa' } },
|
|
100
|
+
{ name: 'mdi:home', label: '旋转效果', style: { transform: 'rotate(45deg)' } },
|
|
101
|
+
{ name: 'mdi:home', label: '背景填充', style: { backgroundColor: '#eee', padding: '5px', borderRadius: '4px' } },
|
|
102
|
+
{ name: 'mdi:home', label: '悬停效果', class: 'hover-effect', style: {} },
|
|
103
|
+
]
|
|
104
|
+
|
|
105
|
+
// UnoCSS样式设例
|
|
106
|
+
const unocssStyleExamples = [
|
|
107
|
+
{ name: 'i-mdi:home', label: '默认样式', classes: '' },
|
|
108
|
+
{ name: 'i-mdi:home', label: '大尺寸 (text-3xl)', classes: 'text-3xl' },
|
|
109
|
+
{ name: 'i-mdi:home', label: '自定义颜色 (text-blue-500)', classes: 'text-blue-500' },
|
|
110
|
+
{ name: 'i-mdi:home', label: '旋转效果 (transform rotate-45)', classes: 'transform rotate-45' },
|
|
111
|
+
{ name: 'i-mdi:home', label: '背景填充 (bg-gray-200 p-1 rounded)', classes: 'bg-gray-200 p-1 rounded' },
|
|
112
|
+
{ name: 'i-mdi:home', label: '悬停效果 (hover:scale-125)', classes: 'transition hover:scale-125' },
|
|
113
|
+
]
|
|
114
|
+
|
|
115
|
+
// 使用方法示例代码
|
|
116
|
+
const usageExamples = [
|
|
117
|
+
{
|
|
118
|
+
title: '基本使用',
|
|
119
|
+
code: '<Icon icon="mdi:home" />',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
title: '设置尺寸',
|
|
123
|
+
code: '<Icon icon="mdi:home" :width="24" :height="24" />',
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
title: '自定义样式',
|
|
127
|
+
code: '<Icon icon="mdi:home" style="color: red; font-size: 24px;" />',
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
title: '内联样式',
|
|
131
|
+
code: '<Icon icon="mdi:home" :style="{ color: \'#1989fa\', fontSize: \'24px\' }" />',
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
title: '自定义类名',
|
|
135
|
+
code: '<Icon icon="mdi:home" class="custom-icon" />',
|
|
136
|
+
},
|
|
137
|
+
]
|
|
138
|
+
|
|
139
|
+
// UnoCSS使用方法示例代码
|
|
140
|
+
const unocssUsageExamples = [
|
|
141
|
+
{
|
|
142
|
+
title: '基本使用',
|
|
143
|
+
code: '<div class="i-mdi:home"></div>',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
title: '设置尺寸',
|
|
147
|
+
code: '<div class="i-mdi:home text-2xl"></div>',
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
title: '自定义颜色',
|
|
151
|
+
code: '<div class="i-mdi:home text-red-500"></div>',
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
title: '添加多个样式',
|
|
155
|
+
code: '<div class="i-mdi:home p-1 bg-gray-100 rounded text-blue-500"></div>',
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
title: '交互效果',
|
|
159
|
+
code: '<div class="i-mdi:home transition hover:text-green-500 hover:scale-125"></div>',
|
|
160
|
+
},
|
|
161
|
+
]
|
|
162
|
+
|
|
163
|
+
// 过滤显示的图标
|
|
164
|
+
const filteredCategories = computed(() => {
|
|
165
|
+
if (!searchKeyword.value) {
|
|
166
|
+
return iconCategories
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return iconCategories.map((category) => {
|
|
170
|
+
const filteredIcons = category.icons.filter(icon =>
|
|
171
|
+
icon.name.toLowerCase().includes(searchKeyword.value.toLowerCase())
|
|
172
|
+
|| icon.label.toLowerCase().includes(searchKeyword.value.toLowerCase()),
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
return {
|
|
176
|
+
...category,
|
|
177
|
+
icons: filteredIcons,
|
|
178
|
+
}
|
|
179
|
+
}).filter(category => category.icons.length > 0)
|
|
180
|
+
})
|
|
181
|
+
|
|
182
|
+
// 过滤UnoCSS图标
|
|
183
|
+
const filteredUnocssIcons = computed(() => {
|
|
184
|
+
if (!searchKeyword.value) {
|
|
185
|
+
return unocssIcons
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return unocssIcons.filter(icon =>
|
|
189
|
+
icon.name.toLowerCase().includes(searchKeyword.value.toLowerCase())
|
|
190
|
+
|| icon.label.toLowerCase().includes(searchKeyword.value.toLowerCase()),
|
|
191
|
+
)
|
|
192
|
+
})
|
|
193
|
+
</script>
|
|
194
|
+
|
|
195
|
+
<template>
|
|
196
|
+
<div class="iconify-view">
|
|
197
|
+
<VanNavBar
|
|
198
|
+
title="Iconify 图标使用示例"
|
|
199
|
+
left-arrow
|
|
200
|
+
@click-left="router.back()"
|
|
201
|
+
/>
|
|
202
|
+
|
|
203
|
+
<div class="container">
|
|
204
|
+
<section class="intro-section">
|
|
205
|
+
<h2>Iconify 图标使用</h2>
|
|
206
|
+
<p>
|
|
207
|
+
Iconify 是一个开源的图标框架,提供超过 100,000 个开源图标。在本项目中有两种使用方式:
|
|
208
|
+
</p>
|
|
209
|
+
</section>
|
|
210
|
+
|
|
211
|
+
<VanTabs v-model:active="activeTab" animated>
|
|
212
|
+
<VanTab title="@iconify/vue 组件">
|
|
213
|
+
<section class="intro-section">
|
|
214
|
+
<p>
|
|
215
|
+
使用 @iconify/vue 提供的 Icon 组件可以直接在模板中渲染图标。
|
|
216
|
+
</p>
|
|
217
|
+
</section>
|
|
218
|
+
|
|
219
|
+
<section class="icons-section">
|
|
220
|
+
<div v-for="(category, index) in filteredCategories" :key="index" class="icon-category">
|
|
221
|
+
<h3>{{ category.title }}</h3>
|
|
222
|
+
<VanGrid :column-num="4" :border="false">
|
|
223
|
+
<VanGridItem v-for="(icon, iconIndex) in category.icons" :key="iconIndex">
|
|
224
|
+
<div class="icon-item">
|
|
225
|
+
<Icon :icon="icon.name" width="28" height="28" />
|
|
226
|
+
<div class="icon-label">
|
|
227
|
+
{{ icon.label }}
|
|
228
|
+
</div>
|
|
229
|
+
<div class="icon-name">
|
|
230
|
+
{{ icon.name }}
|
|
231
|
+
</div>
|
|
232
|
+
</div>
|
|
233
|
+
</VanGridItem>
|
|
234
|
+
</VanGrid>
|
|
235
|
+
</div>
|
|
236
|
+
</section>
|
|
237
|
+
|
|
238
|
+
<VanDivider />
|
|
239
|
+
|
|
240
|
+
<section class="style-section">
|
|
241
|
+
<h3>样式自定义示例</h3>
|
|
242
|
+
<VanGrid :column-num="3" :border="false">
|
|
243
|
+
<VanGridItem v-for="(example, index) in styleExamples" :key="index">
|
|
244
|
+
<div class="style-example">
|
|
245
|
+
<Icon
|
|
246
|
+
:icon="example.name"
|
|
247
|
+
width="28"
|
|
248
|
+
height="28"
|
|
249
|
+
:style="example.style"
|
|
250
|
+
:class="example.class"
|
|
251
|
+
/>
|
|
252
|
+
<div class="style-label">
|
|
253
|
+
{{ example.label }}
|
|
254
|
+
</div>
|
|
255
|
+
</div>
|
|
256
|
+
</VanGridItem>
|
|
257
|
+
</VanGrid>
|
|
258
|
+
</section>
|
|
259
|
+
|
|
260
|
+
<VanDivider />
|
|
261
|
+
|
|
262
|
+
<section class="usage-section">
|
|
263
|
+
<h3>使用方法</h3>
|
|
264
|
+
<VanCellGroup inset>
|
|
265
|
+
<VanCell v-for="(example, index) in usageExamples" :key="index" :title="example.title">
|
|
266
|
+
<template #value>
|
|
267
|
+
<code class="code-example">{{ example.code }}</code>
|
|
268
|
+
</template>
|
|
269
|
+
</VanCell>
|
|
270
|
+
</VanCellGroup>
|
|
271
|
+
</section>
|
|
272
|
+
|
|
273
|
+
<section class="usage-guide">
|
|
274
|
+
<h3>使用指南</h3>
|
|
275
|
+
<div class="guide-content">
|
|
276
|
+
<h4>1. 安装</h4>
|
|
277
|
+
<code class="code-block">npm install @iconify/vue</code>
|
|
278
|
+
|
|
279
|
+
<h4>2. 导入</h4>
|
|
280
|
+
<code class="code-block">import { Icon } from '@iconify/vue'</code>
|
|
281
|
+
|
|
282
|
+
<h4>3. 在模板中使用</h4>
|
|
283
|
+
<code class="code-block"><Icon icon="mdi:home" /></code>
|
|
284
|
+
</div>
|
|
285
|
+
</section>
|
|
286
|
+
</VanTab>
|
|
287
|
+
|
|
288
|
+
<VanTab title="UnoCSS 图标类">
|
|
289
|
+
<section class="intro-section">
|
|
290
|
+
<p>
|
|
291
|
+
使用 UnoCSS 的图标预设,可以通过类名直接使用图标,无需导入组件。
|
|
292
|
+
</p>
|
|
293
|
+
</section>
|
|
294
|
+
|
|
295
|
+
<VanDivider />
|
|
296
|
+
|
|
297
|
+
<section class="style-section">
|
|
298
|
+
<h3>样式自定义示例</h3>
|
|
299
|
+
<VanGrid :column-num="3" :border="false">
|
|
300
|
+
<VanGridItem v-for="(example, index) in unocssStyleExamples" :key="index">
|
|
301
|
+
<div class="style-example">
|
|
302
|
+
<div :class="`${example.name} ${example.classes}`" />
|
|
303
|
+
<div class="style-label">
|
|
304
|
+
{{ example.label }}
|
|
305
|
+
</div>
|
|
306
|
+
</div>
|
|
307
|
+
</VanGridItem>
|
|
308
|
+
</VanGrid>
|
|
309
|
+
</section>
|
|
310
|
+
|
|
311
|
+
<VanDivider />
|
|
312
|
+
|
|
313
|
+
<section class="usage-section">
|
|
314
|
+
<h3>使用方法</h3>
|
|
315
|
+
<VanCellGroup inset>
|
|
316
|
+
<VanCell v-for="(example, index) in unocssUsageExamples" :key="index" :title="example.title">
|
|
317
|
+
<template #value>
|
|
318
|
+
<code class="code-example">{{ example.code }}</code>
|
|
319
|
+
</template>
|
|
320
|
+
</VanCell>
|
|
321
|
+
</VanCellGroup>
|
|
322
|
+
</section>
|
|
323
|
+
|
|
324
|
+
<section class="usage-guide">
|
|
325
|
+
<h3>使用指南</h3>
|
|
326
|
+
<div class="guide-content">
|
|
327
|
+
<h4>项目配置</h4>
|
|
328
|
+
<p>本项目已通过 Vite 配置了 UnoCSS 的图标预设:</p>
|
|
329
|
+
<code class="code-block">
|
|
330
|
+
{{ `
|
|
331
|
+
// build/vite/index.ts
|
|
332
|
+
UnoCSS({
|
|
333
|
+
presets: [
|
|
334
|
+
presetIcons({
|
|
335
|
+
scale: 1.2,
|
|
336
|
+
warn: true,
|
|
337
|
+
extraProperties: {
|
|
338
|
+
'display': 'inline-block',
|
|
339
|
+
'vertical-align': 'middle',
|
|
340
|
+
// ...
|
|
341
|
+
},
|
|
342
|
+
}),
|
|
343
|
+
],
|
|
344
|
+
}),
|
|
345
|
+
` }}
|
|
346
|
+
</code>
|
|
347
|
+
|
|
348
|
+
<h4>使用方式</h4>
|
|
349
|
+
<p>直接在 HTML 元素上使用图标类名,格式为:<code>i-{collection}:{name}</code></p>
|
|
350
|
+
<code class="code-block"><div class="i-mdi:home"></div></code>
|
|
351
|
+
|
|
352
|
+
<h4>结合其他 UnoCSS 类</h4>
|
|
353
|
+
<p>可以结合 UnoCSS 的其他工具类设置图标样式:</p>
|
|
354
|
+
<code class="code-block"><div class="i-mdi:home text-blue-500 text-2xl"></div></code>
|
|
355
|
+
</div>
|
|
356
|
+
</section>
|
|
357
|
+
</VanTab>
|
|
358
|
+
</VanTabs>
|
|
359
|
+
|
|
360
|
+
<VanDivider />
|
|
361
|
+
|
|
362
|
+
<section class="usage-guide">
|
|
363
|
+
<h3>图标集</h3>
|
|
364
|
+
<div class="guide-content">
|
|
365
|
+
<p>Iconify 支持多个图标集,格式为 "集合名:图标名"。例如:</p>
|
|
366
|
+
<ul>
|
|
367
|
+
<li>mdi:home - Material Design Icons</li>
|
|
368
|
+
<li>fa:user - Font Awesome</li>
|
|
369
|
+
<li>carbon:settings - Carbon</li>
|
|
370
|
+
<li>更多图标集可访问 <a href="https://icon-sets.iconify.design/" target="_blank">Iconify Icon Sets</a></li>
|
|
371
|
+
</ul>
|
|
372
|
+
</div>
|
|
373
|
+
</section>
|
|
374
|
+
</div>
|
|
375
|
+
</div>
|
|
376
|
+
</template>
|
|
377
|
+
|
|
378
|
+
<style scoped lang="less">
|
|
379
|
+
.iconify-view {
|
|
380
|
+
background-color: #f7f8fa;
|
|
381
|
+
min-height: 100vh;
|
|
382
|
+
|
|
383
|
+
.container {
|
|
384
|
+
padding: var(--base-interval-2);
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
.intro-section,
|
|
388
|
+
.icons-section,
|
|
389
|
+
.style-section,
|
|
390
|
+
.usage-section,
|
|
391
|
+
.usage-guide {
|
|
392
|
+
margin-bottom: 20px;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
h2 {
|
|
396
|
+
font-size: 20px;
|
|
397
|
+
margin-bottom: 12px;
|
|
398
|
+
color: #323233;
|
|
399
|
+
}
|
|
400
|
+
|
|
401
|
+
h3 {
|
|
402
|
+
font-size: 16px;
|
|
403
|
+
margin-bottom: 12px;
|
|
404
|
+
color: #323233;
|
|
405
|
+
padding-left: 12px;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
h4 {
|
|
409
|
+
font-size: 14px;
|
|
410
|
+
margin: 12px 0 8px;
|
|
411
|
+
color: #323233;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
p {
|
|
415
|
+
font-size: 14px;
|
|
416
|
+
color: #646566;
|
|
417
|
+
line-height: 1.5;
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.icon-category {
|
|
421
|
+
margin-bottom: 16px;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.icon-item {
|
|
425
|
+
display: flex;
|
|
426
|
+
flex-direction: column;
|
|
427
|
+
align-items: center;
|
|
428
|
+
padding: 12px 0;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
.icon-label {
|
|
432
|
+
margin-top: 8px;
|
|
433
|
+
font-size: 12px;
|
|
434
|
+
color: #323233;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
.icon-name {
|
|
438
|
+
margin-top: 4px;
|
|
439
|
+
font-size: 10px;
|
|
440
|
+
color: #969799;
|
|
441
|
+
overflow: hidden;
|
|
442
|
+
text-overflow: ellipsis;
|
|
443
|
+
white-space: nowrap;
|
|
444
|
+
max-width: 90%;
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
.style-example {
|
|
448
|
+
display: flex;
|
|
449
|
+
flex-direction: column;
|
|
450
|
+
align-items: center;
|
|
451
|
+
padding: 12px 0;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
.style-label {
|
|
455
|
+
margin-top: 8px;
|
|
456
|
+
font-size: 12px;
|
|
457
|
+
color: #323233;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
.code-example {
|
|
461
|
+
font-size: 12px;
|
|
462
|
+
color: #333;
|
|
463
|
+
background-color: #f5f5f5;
|
|
464
|
+
padding: 2px 4px;
|
|
465
|
+
border-radius: 2px;
|
|
466
|
+
overflow-wrap: break-word;
|
|
467
|
+
word-break: break-all;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.code-block {
|
|
471
|
+
display: block;
|
|
472
|
+
font-size: 12px;
|
|
473
|
+
color: #333;
|
|
474
|
+
background-color: #f5f5f5;
|
|
475
|
+
padding: 8px 12px;
|
|
476
|
+
border-radius: 4px;
|
|
477
|
+
margin: 8px 0;
|
|
478
|
+
overflow-x: auto;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
.guide-content {
|
|
482
|
+
background-color: white;
|
|
483
|
+
padding: 16px;
|
|
484
|
+
border-radius: 8px;
|
|
485
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.guide-content ul {
|
|
489
|
+
padding-left: 16px;
|
|
490
|
+
margin: 8px 0;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
.guide-content li {
|
|
494
|
+
font-size: 13px;
|
|
495
|
+
color: #646566;
|
|
496
|
+
line-height: 1.6;
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
.hover-effect {
|
|
500
|
+
transition: transform 0.3s ease;
|
|
501
|
+
|
|
502
|
+
&:hover {
|
|
503
|
+
transform: scale(1.2);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
</style>
|
|
@@ -9,8 +9,8 @@ const selectedLocation = ref<LocationResult>()
|
|
|
9
9
|
|
|
10
10
|
// 处理位置选择
|
|
11
11
|
function handleLocationConfirm(location: LocationResult) {
|
|
12
|
-
console.log('选择的位置:', location)
|
|
13
|
-
selectedLocation.value = location
|
|
12
|
+
// console.log('选择的位置:', location)
|
|
13
|
+
// selectedLocation.value = location
|
|
14
14
|
showNotify({ type: 'success', message: '位置已选择' })
|
|
15
15
|
}
|
|
16
16
|
</script>
|