我在 Vue2 中进行项目并使用 element-ui,但我们想将项目升级到 Vue3。为此,我们需要传递 Element-plus(element-ui 与 Vue3 不兼容)。
我们成功地传递了 Vue3,但是当我们想要使用 element comp 时,我们总是遇到相同的问题。控制台中出现错误,我不明白为什么。我怀疑使用 vue-loader 将我的 SFC 文件转换为渲染器函数时出现问题。
我的测试页面:
<template>
<div id="app">
<el-date-picker
v-model="value1"
type="date"
placeholder="Pick a day"
/>
</div>
</template>
<script>
const default_layout = "default";
export default {
name: "App",
components: {
},
data() {
return {
value1: null
};
},
Run Code Online (Sandbox Code Playgroud)
vue.config.js:
module.exports = {
lintOnSave: false,
chainWebpack: config => {
config.resolve.alias.set("vue", "@vue/compat");
config.module
.rule("vue")
.use("vue-loader")
.tap(options => {
return {
...options,
compilerOptions: {
compatConfig: {
MODE: 2
} …Run Code Online (Sandbox Code Playgroud)