登录(做优化,可以不用)">
赞
踩
npm install element-plus@next
main.js
中引入组件,注意要引入.css文件,图标也要单独引用)import { createApp } from 'vue' import ElementPlus from 'element-plus' import 'element-plus/dist/index.css' import elementIcon from "./plugins/icons"; import { createPinia } from 'pinia' import axios from "axios" // import './style.css' import router from './router' import App from './App.vue' const pinia = createPinia() const app = createApp(App); app.use(ElementPlus); app.use(router); app.use(pinia); app.use(elementIcon); app.config.globalProperties.$axios = axios app.mount('#app')
<template> <el-form :model="user" label-width="120px" id="login"> <el-form-item label="用户名" for="username"> <el-input v-model="user.username" id="username" placeholder="请输入用户名" /> </el-form-item> <el-form-item label="密码" for="password"> <el-input v-model="user.password" id="password" placeholder="请输入密码" /> </el-form-item> <el-button @click="login" margin="0 auto">登录</el-button> </el-form> </template>
(做优化,可以不用)
// babel.config.js module.exports = { presets: [ '@vue/cli-plugin-babel/preset' ], plugins: [ [ 'import', { libraryName: 'element-plus', customStyleName: (name) => { return `element-plus/lib/theme-chalk/${name}.css`; } }, 'element-plus' ] ] };
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。