x-extends / vxe-table

Vxe table 的表格组件
https://vxetable.cn
MIT License
7.61k stars 1.05k forks source link

升级到1.0.6项目就运行不起来了 #61

Closed chinabomb closed 5 years ago

chinabomb commented 5 years ago

描述 Describe

用1.0.0-beta.15可以,升级到更高版本项目就运行不起来了, 运行报这个错,也不知道什么原因 app.js:241716 Uncaught TypeError: Cannot read property 'install' of undefined at Function.Vue.use (app.js:241716) at Module../src/main.js (app.js:321055) at webpack_require (app.js:725) at fn (app.js:102) at Object.0 (app.js:336142) at webpack_require (app.js:725) at app.js:792 at app.js:795

请填写以下版本信息 please complete the following information

xuliangzhan commented 5 years ago

请提供完整的版本信息,可能是版本没对上

chinabomb commented 5 years ago

我直接创建个vuecli项目,然后安装 npm install xe-utils vxe-table vxe-table-plugin-element 具体的版本信息: "dependencies": { "core-js": "^2.6.5", "mockjs": "^1.0.1-beta3", "vue": "^2.6.10", "vxe-table": "^1.1.0-beta.3", "vxe-table-plugin-element": "^1.0.0", "xe-utils": "^1.9.4" }, "devDependencies": { "@vue/cli-plugin-babel": "^3.8.0", "@vue/cli-plugin-eslint": "^3.8.0", "@vue/cli-service": "^3.8.0", "babel-eslint": "^10.0.1", "eslint": "^5.16.0", "eslint-plugin-vue": "^5.0.0", "vue-template-compiler": "^2.6.10" },

运行项目就会报 Uncaught TypeError: Cannot read property 'install' of undefined at Function.Vue.use (vue.runtime.esm.js?2b0e:5100) at eval (main.js?56d7:21) at Module../src/main.js (app.js:2467) at webpack_require (app.js:724) at fn (app.js:101) at Object.1 (app.js:2481) at webpack_require (app.js:724) at app.js:791 at app.js:794

xuliangzhan commented 5 years ago

你这样更新依赖 npm install vue xe-utils vxe-table vxe-table-plugin-element

chinabomb commented 5 years ago

还是不行啊

npm install vue xe-utils vxe-table vxe-table-plugin-element

package.json
{ "name": "cli_first", "version": "0.1.0", "private": true, "scripts": { "serve": "vue-cli-service serve", "build": "vue-cli-service build", "lint": "vue-cli-service lint" }, "dependencies": { "core-js": "^2.6.5", "mockjs": "^1.0.1-beta3", "vue": "^2.6.10", "vxe-table": "^1.1.0", "vxe-table-plugin-element": "^1.0.0", "xe-utils": "^1.9.4" }, "devDependencies": { "@vue/cli-plugin-babel": "^3.8.0", "@vue/cli-plugin-eslint": "^3.8.0", "@vue/cli-service": "^3.8.0", "babel-eslint": "^10.0.1", "eslint": "^5.16.0", "eslint-plugin-vue": "^5.0.0", "vue-template-compiler": "^2.6.10" }, "eslintConfig": { "root": true, "env": { "node": true }, "extends": [ "plugin:vue/essential", "eslint:recommended" ], "rules": {}, "parserOptions": { "parser": "babel-eslint" } }, "postcss": { "plugins": { "autoprefixer": {} } }, "browserslist": [ "> 1%", "last 2 versions" ] }

xuliangzhan commented 5 years ago

调用代码发下

chinabomb commented 5 years ago

测试的完整项目 http://47.98.196.151/cli_first.zip

main.js

import Vue from 'vue' import App from './App.vue'

Vue.config.productionTip = false

// 注册vxetable表格组件 import VXETable, { Table, TableColumn, Grid, Excel, Pagination, Checkbox, Radio, Button, Input } from 'vxe-table' import VXETablePluginElement from 'vxe-table-plugin-element' import 'vxe-table-plugin-element/dist/style.css' import 'vxe-table/lib/index.css' Vue.use(Table) Vue.use(TableColumn) Vue.use(Grid) Vue.use(Excel) Vue.use(Pagination) Vue.use(Checkbox) Vue.use(Radio) Vue.use(Input) Vue.use(Button) VXETable.use(VXETablePluginElement) // 设置全局默认参数 VXETable.setup({ size: 'small', tooltipConfig: { zIndex: 9999 } }) new Vue({ render: h => h(App), }).$mount('#app')

xuliangzhan commented 5 years ago

完整引用

import Vue from 'vue'
import VXETable from 'vxe-table'
import 'vxe-table/lib/index.css'

Vue.use(VXETable)

按需加载,配合 babel-plugin-import

import {
  VXETable,
  Table,
  TableColumn,
  TableHeader,
  TableBody    
} from 'vxe-table'
import zhCNLocat from 'vxe-table/lib/locale/lang/zh-CN'

Vue.use(Table)
Vue.use(TableColumn)
Vue.use(TableHeader)
Vue.use(TableBody)

// 按需加载的方式默认是不带国际化的,需要自行导入
VXETable.setup({
  size: 'small',
  tooltipConfig: {
    zIndex: 9999
  },
  i18n: (key, value) => VXETable.t(zhCNLocat, key)
})
chinabomb commented 5 years ago

非常感谢你的帮助,我刚接触npm,是我不会用