fix: 编译错误
This commit is contained in:
18
bin/build.ts
18
bin/build.ts
@ -2,8 +2,8 @@
|
||||
* @Author: zhaojinfeng 121016171@qq.com
|
||||
* @Date: 2023-06-19 10:38:07
|
||||
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||
* @LastEditTime: 2023-06-20 16:41:47
|
||||
* @FilePath: \tianheng-design\bin\build.ts
|
||||
* @LastEditTime: 2023-07-21 04:26:58
|
||||
* @FilePath: \vue3\bin\build.ts
|
||||
* @Description:
|
||||
*
|
||||
*/
|
||||
@ -42,15 +42,25 @@ function buildAComponent(name: string) {
|
||||
})
|
||||
}
|
||||
|
||||
function dirPathToName(dirPath: string) {
|
||||
let component = ''
|
||||
|
||||
dirPath.split('-').forEach((name) => {
|
||||
const first = name[0]
|
||||
component += first.toUpperCase() + name.slice(1)
|
||||
})
|
||||
return component
|
||||
}
|
||||
|
||||
async function renderDTSwithESM(dir: string[]) {
|
||||
const text = await renderFile(resolve(process.cwd(), './ejs/index.esm.ts.ejs'), { dir })
|
||||
const text = await renderFile(resolve(process.cwd(), './ejs/index.esm.ts.ejs'), { dir, dirPathToName })
|
||||
return Promise.all([
|
||||
outputFile(resolve(process.cwd(), './es/index.mjs'), text),
|
||||
outputFile(resolve(process.cwd(), './es/index.d.ts'), text),
|
||||
])
|
||||
}
|
||||
async function renderDTSwithUMD(dir: string[]) {
|
||||
const text = await renderFile(resolve(process.cwd(), './ejs/index.umd.ts.ejs'), { dir })
|
||||
const text = await renderFile(resolve(process.cwd(), './ejs/index.umd.ts.ejs'), { dir, dirPathToName })
|
||||
return Promise.all([
|
||||
outputFile(resolve(process.cwd(), './lib/index.d.ts'), text),
|
||||
])
|
||||
|
@ -1,9 +1,9 @@
|
||||
<% dir.forEach(name => { -%>
|
||||
import <%- name %> from './<%- name %>/index.vue';
|
||||
<% dir.forEach(dirPath => { -%>
|
||||
import <%- dirPathToName(dirPath) %> from './<%- dirPath %>/index.vue';
|
||||
<% }) -%>
|
||||
|
||||
export {
|
||||
<% dir.forEach((name, index) => { -%>
|
||||
<%- name %><% if (dir.length>index+1) { %>,<% } %>
|
||||
<% dir.forEach((dirPath, index) => { -%>
|
||||
<%- dirPathToName(dirPath) %><% if (dir.length>index+1) { %>,<% } %>
|
||||
<% }) -%>
|
||||
}
|
||||
|
@ -2,12 +2,12 @@
|
||||
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
<% dir.forEach(name => { -%>
|
||||
var <%- name %> = require('./<%- name %>/index.js');
|
||||
<% dir.forEach(dirPath => { -%>
|
||||
var <%- dirPathToName(dirPath) %> = require('./<%- dirPath %>/index.js');
|
||||
<% }) -%>
|
||||
var Components = [
|
||||
<% dir.forEach(name => { -%>
|
||||
<%- name %>,
|
||||
<% dir.forEach(dirPath => { -%>
|
||||
<%- dirPathToName(dirPath) %>,
|
||||
<% }) -%>
|
||||
]
|
||||
|
||||
|
@ -2,14 +2,17 @@
|
||||
* @Author: zhaojinfeng 121016171@qq.com
|
||||
* @Date: 2023-07-21 00:37:46
|
||||
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||
* @LastEditTime: 2023-07-21 03:31:04
|
||||
* @LastEditTime: 2023-07-21 04:02:43
|
||||
* @FilePath: \vue3\packages\upload-single-file\index.vue
|
||||
* @Description:
|
||||
*
|
||||
-->
|
||||
<template>
|
||||
<div v-loading="loading" @click="startUpload">
|
||||
<slot :loading="loading">
|
||||
<slot v-if="modelValue" name="download" :loading="loading">
|
||||
<DownloadLink :src="modelValue" :file-name="fileName" />
|
||||
</slot>
|
||||
<slot v-else name="upload" :loading="loading">
|
||||
<el-button type="primary" plain :text="text">
|
||||
点击上传
|
||||
</el-button>
|
||||
@ -18,6 +21,8 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="ThUploadSingleFile">
|
||||
import DownloadLink from '../download-link/index.vue'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 文件id */
|
||||
modelValue?: string | number
|
||||
|
@ -14,10 +14,10 @@
|
||||
</el-table-column>
|
||||
<el-table-column align="center" :label="label2">
|
||||
<template #default="{ row, $index }">
|
||||
<download-link v-if="row.createdBy" :src="row" :file-name="row.name">
|
||||
<DownloadLink v-if="row.createdBy" :src="row" :file-name="row.name">
|
||||
{{ row.name }}
|
||||
</download-link>
|
||||
<upload-single-file
|
||||
</DownloadLink>
|
||||
<UploadSingleFile
|
||||
v-else
|
||||
:accept="accept"
|
||||
:auto-upload="allLoading[`${row.id}`]"
|
||||
@ -66,6 +66,9 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup name="ThUploadTable">
|
||||
import DownloadLink from '../download-link/index.vue'
|
||||
import UploadSingleFile from '../upload-single-file/index.vue'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
/** 上传格式 */
|
||||
accept?: string
|
||||
|
8
types/components.d.ts
vendored
8
types/components.d.ts
vendored
@ -13,12 +13,7 @@ declare module 'vue' {
|
||||
ElCol: typeof import('element-plus/es')['ElCol']
|
||||
ElDialog: typeof import('element-plus/es')['ElDialog']
|
||||
ElIcon: typeof import('element-plus/es')['ElIcon']
|
||||
ElInput: typeof import('element-plus/es')['ElInput']
|
||||
ElLink: typeof import('element-plus/es')['ElLink']
|
||||
ElPopconfirm: typeof import('element-plus/es')['ElPopconfirm']
|
||||
ElRow: typeof import('element-plus/es')['ElRow']
|
||||
ElTable: typeof import('element-plus/es')['ElTable']
|
||||
ElTableColumn: typeof import('element-plus/es')['ElTableColumn']
|
||||
Header: typeof import('./../packages/header/index.vue')['default']
|
||||
PreviewOffice: typeof import('./../packages/preview-office/index.vue')['default']
|
||||
PreviewOfficeView: typeof import('./../packages/preview-office-view/index.vue')['default']
|
||||
@ -29,7 +24,4 @@ declare module 'vue' {
|
||||
UploadSingleFile: typeof import('./../packages/upload-single-file/index.vue')['default']
|
||||
UploadTable: typeof import('./../packages/upload-table/index.vue')['default']
|
||||
}
|
||||
export interface ComponentCustomProperties {
|
||||
vLoading: typeof import('element-plus/es')['ElLoadingDirective']
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: zhaojinfeng 121016171@qq.com
|
||||
* @Date: 2023-06-15 13:22:04
|
||||
* @LastEditors: zhaojinfeng 121016171@qq.com
|
||||
* @LastEditTime: 2023-07-20 13:05:21
|
||||
* @LastEditTime: 2023-07-21 04:29:57
|
||||
* @FilePath: \vue3\vite.config.ts
|
||||
* @Description:
|
||||
*
|
||||
@ -11,7 +11,7 @@ import { URL, fileURLToPath } from 'node:url'
|
||||
import { defineConfig } from 'vite'
|
||||
import vue from '@vitejs/plugin-vue'
|
||||
import vueJsx from '@vitejs/plugin-vue-jsx'
|
||||
import libCss from 'vite-plugin-libcss'
|
||||
// import libCss from 'vite-plugin-libcss'
|
||||
import AutoImport from 'unplugin-auto-import/vite'
|
||||
import eslint from 'vite-plugin-eslint'
|
||||
import Components from 'unplugin-vue-components/vite'
|
||||
@ -40,7 +40,7 @@ export default defineConfig({
|
||||
plugins: [
|
||||
vue({ reactivityTransform: true }),
|
||||
vueJsx(),
|
||||
libCss({}),
|
||||
// libCss({}),
|
||||
AutoImport({
|
||||
resolvers: [
|
||||
ElementPlusResolver(),
|
||||
|
Reference in New Issue
Block a user