vue element-plus使用

2023-02-02 15:48:21 浏览数 (1)

中文社区

https://element-plus.org/zh-CN/

  • 全局自动导入
代码语言:javascript复制
const { defineConfig } = require('@vue/cli-service')
const AutoImport = require('unplugin-auto-import/webpack')
const Components = require('unplugin-vue-components/webpack')
const { ElementPlusResolver } = require('unplugin-vue-components/resolvers')
const NodePolyfillPlugin = require('node-polyfill-webpack-plugin')
module.exports = defineConfig({
  transpileDependencies: true,
  publicPath:".",
  configureWebpack: {
    devtool: 'eval-source-map',
    plugins: [
      AutoImport({
        resolvers: [
          ElementPlusResolver(),
        ],
      }),
      Components({
        resolvers: [
          ElementPlusResolver()
        ],
      }),
      new NodePolyfillPlugin()
    ],
  },
})

package.json中配置,项目中开启debugger和console

代码语言:javascript复制
 "rules": {
      "no-debugger": "off",
      "no-console": "off"
    }

异常

el-input无法输入问题,检查事件监听,keydown、keypress事件是否被全局的window事件占用(可以查到相关模块)

0 人点赞