零度星河
返回
发布于 更新于 阅读:391 评论:0

vform3 源码编译打包其他项目引入使用

vform3源码编译引入项目 遇到的问题 当通过import引入vform3时遇到以下错误 image image 安装依赖 于是改变方式通过npm install将编译后的文件以依赖包方式加载到项目中,操作如下: 在项目中创建vform3-builds文件夹,将vform3打包生成的dist文件夹

vform3源码编译引入项目

遇到的问题
  • 当通过import引入vform3时遇到以下错误 image

image

安装依赖
  • 于是改变方式通过npm install将编译后的文件以依赖包方式加载到项目中,操作如下:
  • 在项目中创建vform3-builds文件夹,将vform3打包生成的dist文件夹复制到此文件夹中
  • 并在vform3-builds文件夹中创建package.json文件,添加以下内容
1
2
3
4
5
6
7
8
9
10
11
12
{
"name": "vform3-builds",
"version": "3.0.10",
"private": false,
"main": "dist/designer.umd.js",
"keywords": [
"variant-form",
"vform",
"element-ui",
"form-designer"
]
}
  • 项目根目录下的package.json引入依赖,如下
1
2
3
4
"dependencies": {
// 这里指定vform3存放路径
"vform3-builds": "file:./vform3-builds"
},
  • 执行npm install 安装依赖
  • 此时可以通过以下方式在main.ts中引入插件
1
2
3
4
5
import ElementPlus from 'element-plus' //引入element-plus库
import 'element-plus/dist/index.css' //引入element-plus样式
 
import VForm3 from 'vform3-builds' //引入VForm3库
import 'vform3-builds/dist/designer.style.css' //引入VForm3样式
  • 到此已经可是正常使用插件了
评论 (0)
暂无评论 来抢沙发吧~

目录

SpringWonderland

探索 Spring 生态的奇妙世界

2025-05-15 08:50

我的标签

随笔分类

归档

查看完整归档 →