diff --git a/install-render.js b/install-render.js index 563eab6..3b3de8d 100644 --- a/install-render.js +++ b/install-render.js @@ -32,10 +32,9 @@ const install = (app) => { }) } -// if (typeof window !== 'undefined' && window.Vue) { /* script方式引入时主动调用install方法!! */ -// window.axios = axios -// install(window.Vue); -// } +if (typeof window !== 'undefined' && window.Vue) { /* script方式引入时赋值axios!! */ + window.axios = axios +} export default { install, diff --git a/install.js b/install.js index 1e09ad9..3252f12 100644 --- a/install.js +++ b/install.js @@ -62,10 +62,9 @@ const install = (app) => { }) } -// if (typeof window !== 'undefined' && window.Vue) { /* script方式引入时主动调用install方法!! */ -// window.axios = axios -// install(window.Vue); -// } +if (typeof window !== 'undefined' && window.Vue) { /* script方式引入时赋值axios!! */ + window.axios = axios +} export default { install, diff --git a/package.json b/package.json index f8d6553..3da2efc 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "axios": "^0.24.0", "clipboard": "^2.0.8", "core-js": "^3.6.5", - "element-plus": "^1.3.0-beta.3", + "element-plus": "^1.3.0-beta.9", "file-saver": "^2.0.5", "mitt": "^3.0.0", "sortablejs": "1.14.0", diff --git a/src/components/form-designer/form-widget/field-widget/button-widget.vue b/src/components/form-designer/form-widget/field-widget/button-widget.vue index edbfdcb..21a1f61 100644 --- a/src/components/form-designer/form-widget/field-widget/button-widget.vue +++ b/src/components/form-designer/form-widget/field-widget/button-widget.vue @@ -2,7 +2,7 @@ - -` diff --git a/vite-lib-render.config.js b/vite-lib-render.config.js index ba2f137..3575093 100644 --- a/vite-lib-render.config.js +++ b/vite-lib-render.config.js @@ -14,7 +14,8 @@ export default defineConfig({ vueJsx({}), //解决引入commonjs模块后打包出现的{'default' is not exported by XXX}错误!! - commonjs(), + commonjs({requireReturnsDefault: true}), /* 配置requireReturnsDefault属性, + 解决打包后引入VForm出现的"Axios is not a constructor"错!! */ viteSvgIcons({ // Specify the icon folder to be cached @@ -50,7 +51,7 @@ export default defineConfig({ lib: { entry: resolve(__dirname, 'install-render.js'), name: 'VFormRender', - fileName: (format) => `VFormRender.${format}.js` + fileName: (format) => `render.${format}.js` }, rollupOptions: { // 确保外部化处理那些你不想打包进库的依赖 diff --git a/vite-lib.config.js b/vite-lib.config.js index 291cf8b..c47dd12 100644 --- a/vite-lib.config.js +++ b/vite-lib.config.js @@ -55,7 +55,7 @@ export default defineConfig({ lib: { entry: resolve(__dirname, 'install.js'), name: 'VFormDesigner', - fileName: (format) => `VFormDesigner.${format}.js` + fileName: (format) => `designer.${format}.js` }, rollupOptions: { // 确保外部化处理那些你不想打包进库的依赖