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