Преглед на файлове

fix(FileItem): 修复图标路径问题

fxs преди 1 месец
родител
ревизия
843a3e1172

+ 0 - 1
components.d.ts

@@ -13,7 +13,6 @@ declare module 'vue' {
     CustomFilter: typeof import('./src/components/form/CustomFilter.vue')['default']
     CustomForm: typeof import('./src/components/form/CustomForm.vue')['default']
     CustomTable: typeof import('./src/components/table/CustomTable.vue')['default']
-    CustormCheckBox: typeof import('./src/components/common/CustormCheckBox.vue')['default']
     DropDownSelection: typeof import('./src/components/dataAnalysis/DropDownSelection.vue')['default']
     ElBreadcrumb: typeof import('element-plus/es')['ElBreadcrumb']
     ElBreadcrumbItem: typeof import('element-plus/es')['ElBreadcrumbItem']

+ 0 - 0
src/assets/fileIcon/checkbox-active.png → public/img/fileIcon/checkbox-active.png


+ 0 - 0
src/assets/fileIcon/checkbox-default.png → public/img/fileIcon/checkbox-default.png


+ 0 - 0
src/assets/fileIcon/folder.png → public/img/fileIcon/folder.png


+ 0 - 0
src/assets/fileIcon/img-file.png → public/img/fileIcon/img-file.png


+ 0 - 0
src/assets/fileIcon/json-file.png → public/img/fileIcon/json-file.png


+ 0 - 0
src/assets/fileIcon/mp3-file.png → public/img/fileIcon/mp3-file.png


+ 0 - 0
src/assets/fileIcon/txt-file.png → public/img/fileIcon/txt-file.png


+ 0 - 0
src/assets/fileIcon/unknow-file.png → public/img/fileIcon/unknow-file.png


+ 2 - 2
src/components/common/CustomCheckBox.vue

@@ -32,7 +32,7 @@ const toggle = () => {
   content: '';
   position: absolute;
   inset: 0; /* 等同于 top: 0; right: 0; bottom: 0; left: 0 */
-  background-image: url('@/assets/fileIcon/checkbox-default.png');
+  background-image: url('/public/img/fileIcon/checkbox-default.png');
   background-size: 100% 100%;
   background-repeat: no-repeat;
   background-position: center;
@@ -41,6 +41,6 @@ const toggle = () => {
 
 /* 选中态,切换另一张图 */
 .custom-checkbox.checked::before {
-  background-image: url('@/assets/fileIcon/checkbox-active.png'); /* 自己替换成选中的图 */
+  background-image: url('/public/img/fileIcon/checkbox-active.png'); /* 自己替换成选中的图 */
 }
 </style>

+ 1 - 2
src/components/file/FileItem.vue

@@ -65,9 +65,8 @@ const handleClick = (event: MouseEvent) => {
 
 // 根据文件类型加载图标
 onMounted(async () => {
-  console.log(props.type)
   const path = getFileIconBySuffix(props.name, props.type)
-  console.log(path)
+
   iconUrl.value = await loadResource(path)
 })
 </script>

+ 1 - 1
src/utils/common/index.ts

@@ -271,7 +271,7 @@ export function generateUniqueColors(count: number) {
 }
 
 export const getFileIconBySuffix = (filename: string, fileType: 'folder' | 'file'): string => {
-  const iconBasePath = '/src/assets/fileIcon/'
+  const iconBasePath = '/img/fileIcon/'
   if (fileType === 'folder') return iconBasePath + 'folder.png'
   const suffix = filename.split('.').pop()?.toLowerCase() || ''
   switch (suffix) {