th-pdiot-component-ui
npm install th-pdiot-component-ui- 包含element-ui所有原组件、封装的基础组件、功能性组件、工具类、主题样式类等
- 项目引用
> npm i th-pdiot-component-ui -S
``
/**
* 导入 th-pdiot-component-ui
*/
import ElementUI from 'th-pdiot-component-ui'
import 'th-pdiot-component-ui/lib/theme/index.css'
import 'th-pdiot-component-ui/lib/th-pdiot-component-ui.css'
Vue.use(ElementUI, {
size: 'mini',
menuType: 'text'
})
`
` bash安装依赖
npm install
`
- 表格:
- 分页:
- 表单:
- 表单标题:
- 搜索套件:
- 标签页:
- 下拉选择:
- 下拉菜单:
- 导出表格:
- 导入表格:
- 文件上传:
- 图标:
- 链接:
- 气泡:
- 标签输入框:
- 时间线:
- 图片预览:
- 主题切换:
- 403:
- 404:
- 500:
- 设备选择器:
- 短信通知查询:
- 台区选择器:
- 工单约时:
- 工单督办:
- 圆饼分类图:
- 简化圆饼分类图:
- 圆环形进度条:
- 多环进度条:
- 水球图:
- 曲线图带渐变区域:
- 曲线图:
- 曲线柱形双轴图:
- 柱形分类图:
- 横向柱形进度条:
- 3d地图:
- 2d地图:
- this.$validate
- this.$rules
- this.$moment
- this.$length
- this.$util.serialize
- this.$util.deepClone
- this.$util.download
- this.$util.copy
- this.$localStore
- src/assets/index.scss
- src/assets/font/iconfont.css
- src/assets/theme/src/index.scss
- src/assets/theme/src/common/variable.scss
- src/mixins/color.js
- 即不支持es6语法,需要编译成es5语法的js文件
`js
// 从npm包导出function时正常
import th from 'th-pdiot-component-ui'
const {serialize} = th.util
const {getStore} = th.localStore
// 直接从npm包里的js文件导出function,报语法错误
import {serialize} from 'th-pdiot-component-ui/src/utils/util'
import {getStore} from 'th-pdiot-component-ui/src/utils/store'
`
解决方法:
- 新增babel.config.js文件:
`js`
module.exports = {
presets: [
'@vue/app'
]
}
- 将instal方法里的注册对象移到export里。
`js``
export default {
version: config.version,
install,
...components,
validate,
rules,
util,
localStore,
filters
}