创建过程
-
babel typeScript Router Vuex CSS Pre-processors Linter / Formatter
- vue 版本 3.x
- 使用 class-style component syntax
- Use Babel alongside TypeScript
- Use history mode for router
- Sass/Scss (with node-sass)
- Eslint + prettier
- Lint and fix on commit
- Where do you prefer placing config for Babel, ESLint, etc.? In dedicated config files 单独的文件去管理各种配置
安装 element-plus
vue add element-plus
安装过后会报错找不到./plugin/element 的类型声明
修改 element.js ====>element.ts
修改 element.ts 代码
import ElementPlus from "element-plus";
import "../element-variables.scss";
// import locale from "element-plus/lib/locale/lang/zh-cn";
// import { Vue } from "vue-property-decorator";
import { App } from "vue";
export default (app: App): void => {
app.use(ElementPlus, {});
};
这个时候报错应该就没有了
但是 element-plus 引入还是失败的
还需要修改 main.ts
import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";
import store from "./store";
import installElementPlus from "./plugins/element";
const app = createApp(App);
installElementPlus(app);
app.use(store).use(router).mount("#app");