vue3 快速搭建项目

创建项目

此步骤省略,跟 vue2 的创建步骤一样,只是版本需选择 vue3 即可

安装依赖

yarn add element-plus axios moment js-cookie

导入依赖

main.js

.
.
import ElementPlus from "element-plus";
import "element-plus/dist/index.css";

createApp(App).use(store).use(router).use(ElementPlus).mount("#app");

使用组件

src/views/HomeView.vue

<template>
  <div class="home">
    <el-button type="primary">Primary</el-button>
  </div>
</template>

<script>
export default {
     
  name: "HomeView",
};
</script>

请添加图片描述

CSS 文件

新建 src/styles/common.scss 文件

a {
  color: #1f99b0;
  text-decoration: none;
}

.clear:after {
  display: block;
  content: "clear";
  height: 0;
  clear: both;
  overflow: hidden;
  visibility: hidden;
}

.thumb {
  max-height: 65px;
  max-width: 120px;
}

.gray {
  background: #e6e8ec;
}

新建 src/styles/element-ui.scss 文件

.el-menu-item.is-active {
  color: #1f99b0 !important;
}

.el-switch.is-checked .el-switch__core {
  border-color: #1f99b0 !important;
  background-color: #1f99b0 !important;
}

.el-button--primary {
  color: #fff !important;
  background-color: #1f99b0 !important;
  border-color: #1f99b0 !important;
}

.el-menu-item:focus, .el-menu-item:hover {
  background-color: #e1f0f0 !important;
}

.el-submenu__title:hover {
  background-color: #e1f0f0 !important;
}

.el-tag {
  background-color: #e1f0f0;
  border-color: #e1f0f0;
  color: #1f99b0;
}

.el-button.el-button--default:focus, .el-button.el-button--default:hover {
  color: #1f99b0;
  border-color: #dcdef6;
  background-color: #e1f0f0;
}

.el-radio__input.is-checked .el-radio__inner {
  border-color: #1f99b0;
  background: #1f99b0;
}

.el-radio__input.is-checked + .el-radio__label {
  color: #1f99b0;
}


.el-checkbox__input.is-checked .el-checkbox__inner, .el-checkbox__input.is-indeterminate .el-checkbox__inner {
  background-color: #1f99b0;
  border-color: #1f99b0;
}

.el-button--text{
  color: #1f99b0;
}

.el-button--text:focus, .el-button--text:hover {
  color: #1f99b0;
  text-decoration: underline;
}

.el-input.is-active .el-input__inner, .el-input__inner:focus {
  border-color: #1f99b0;
  outline: 0;
}

.el-cascader-node.in-active-path, .el-cascader-node.is-active, .el-cascader-node.is-selectable.in-checked-path {
  color: #1f99b0;
}

.el-radio__inner:hover {
  border-color: #1f99b0;
}

.el-aside {
  width: 200px;
}

新建 src/styles/layouts.scss 文件

html, body {
  height: 100%;
  margin: 0;
}

#app {
  height: 100%;
}

.el-container, .el-aside, .el-aside .el-col, .el-menu {
  height: 100%;
}

.el-header, .el-footer {
  background-color: #e1f0f0;
  color: #333;
  height: 60px;
  line-height: 60px;
}

.el-header {
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 2;

  .logo {
    height: 40px;
    margin-top: 10px;
    float: left;
  }

  h1 {
    margin: 0 0 0 20px;
    font-size: 18px;
    font-weight: normal;
    float: left;
    line-height: 60px;;
  }
}

.el-footer {
  position: fixed;
  bottom: 0;
  width: 100%;
  z-index: 2;
  text-align: center;
}

.el-aside {
  position: fixed;
  top: 60px;
  width: 100%;
  z-index: 2;
  background-color: #e1f0f0;
  color: #333;
  line-height: 200px;
}

.el-main {
  color: #333;
  overflow: visible;
  margin: 60px 0 0 200px;
  padding-bottom: 80px;
}

.user-info {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin-right: 20px;

  span {
    margin-left: 10px;
  }
}

新建 src/styles/index.scss 文件

@import './common.scss';
@import './element-ui.scss';
@import './layouts.scss';

布局模板

新建 src/views/layouts/components/NavBar.vue 组件

<template>
  <el-header>
    
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值