惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

博客园_首页
博客园 - Franky
大猫的无限游戏
大猫的无限游戏
博客园 - 三生石上(FineUI控件)
量子位
博客园 - 聂微东
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
S
SegmentFault 最新的问题
Apple Machine Learning Research
Apple Machine Learning Research
爱范儿
爱范儿
V
Visual Studio Blog
雷峰网
雷峰网
T
Tailwind CSS Blog
宝玉的分享
宝玉的分享
Blog — PlanetScale
Blog — PlanetScale
有赞技术团队
有赞技术团队
博客园 - 叶小钗
Microsoft Azure Blog
Microsoft Azure Blog
T
The Blog of Author Tim Ferriss
U
Unit 42
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
阮一峰的网络日志
阮一峰的网络日志
Y
Y Combinator Blog

博客园 - 网络来者

Element Plus 多页面后台与 ASP.NET Core API 从零手敲教程 从零创建 MESTOOLS 消息弹窗跟练教程 uni app开发一个子页面 MES物料分摊 墨西哥 嘉兴 兼容车牌摄像头 和 tplink 摄像头的sdk开发包 集成 训练数字识别模型 tplink摄像头监控 mes测试机 redis vue 系统文件结构 udp server 监听服务 第一个服务 c# 开发相关 openclaw 安装 c# 版本号 oracle 触发器 脚本方式安装Python 特定版本 idea 激活 Chrome MCP Server mcp ok mcp_server RepositoryItemGridLookUpEdit 使用 ok devexpress gridcontrol表格知识 winfrom 弹文本框 松下贴片机解锁 Serilog日志组件使用 git 使用
vue学习
网络来者 · 2026-04-02 · via 博客园 - 网络来者

1

npm install -g @vue/cli

vue create vue-hello

cd vue-hello
npm run serve

打开文件:src/App.vue

<template>
  <!-- 页面展示内容 -->
  <div class="hello-page">
    <h1> Hello World!我是 Vue 小白</h1>
  </div>
</template>

<script setup>
// JS 逻辑(现在是空的,不用写代码)
</script>

<style>
/* 简单样式 */
.hello-page {
  text-align: center;
  margin-top: 100px;
  font-size: 24px;
  color: #2c3e50;
}
</style>






vue create 项目名   # 创建项目
cd 项目名          # 进入项目文件夹
npm run serve      # 启动项目

2 只使用Element Plus组件默认的 css样式 ,配色主题等 , 不显式用代码去设置这些吗?我想要一个骨头版的代码来学习

npm install element-plus
npm install @element-plus/icons-vue


打开 src/main.js

import { createApp } from 'vue'
import App from './App.vue'

// 只引入 Element Plus 和默认样式
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' //    最关键的一句话  使用 Element Plus 全部默认样式

const app = createApp(App)
app.use(ElementPlus)
app.mount('#app')

打开 src/App.vue

<template>
  <div>
    <!-- 只用 Element 组件,不写任何自定义 class、style -->
    <h1>Hello Vue + Element Plus 骨头版</h1>

    <el-button>默认按钮</el-button>
    <el-button type="primary">主要按钮</el-button>
    <el-button type="success">成功按钮</el-button>

    <el-input placeholder="我是输入框" style="width: 200px; margin: 0 10px"/>

    <el-card title="卡片标题">
      我是卡片内容
    </el-card>
  </div>
</template>

<script setup>
// 空!什么都不写
</script>

<style>
/* 空!完全不写样式 */
</style>

image

3

企业后台管理系统ui页面,
经典的左侧菜单,右侧顶部工具条,右侧中间大片面积sheet放功能页面
菜单两个大项 1 基础数据   1.1 物料基础数据   1.2 员工基础数据 
两个最简单的页面

vue create vue20260402v2

cd  vue20260402v2

npm install element-plus
npm install @element-plus/icons-vue


npm install vue-router@4
vue3必须安装这个版本 vue-router@4
npm run serve


步骤 1:创建 2 个页面(最简单的骨头页面)
在 src 里新建文件夹 views,再建 2 个文件:

src/views/Material.vue

<template>
  <el-card>
    <h2>物料基础数据</h2>
    <p>这是物料管理页面内容</p>
  </el-card>
</template>

<script>
export default {
  name: 'MaterialView'
}
</script>

src/views/Staff.vue

<template>
  <el-card>
    <h2>员工基础数据</h2>
    <p>这是员工管理页面内容</p>
  </el-card>
</template>

<script>
export default {
  name: 'StaffView'
}
</script>


步骤 2:配置路由(页面跳转规则)
新建文件:src/router/index.js

import { createRouter, createWebHistory } from 'vue-router'
import Material from '../views/Material.vue'
import Staff from '../views/Staff.vue'
import Layout from '../Layout.vue'

const routes = [
  {
    path: '/',
    component: Layout,
    children: [
      {
        path: '',
        redirect: '/material' // 默认打开物料页
      },
      {
        path: 'material',
        component: Material
      },
      {
        path: 'staff',
        component: Staff
      }
    ]
  }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router



步骤 3:main.js 引入路由 + ElementPlus
打开 src/main.js

import { createApp } from 'vue'
import App from './App.vue'
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import router from './router' // 引入路由

const app = createApp(App)
app.use(ElementPlus)
app.use(router) // 使用路由
app.mount('#app')


步骤 4:写【经典后台布局】(最核心!)
新建文件:src/Layout.vue

<template>
  <el-container style="height: 100vh">
    <!-- 左侧菜单 -->
    <el-aside width="220px" style="background-color: #2f4050">
      <el-menu
        default-active="/material"
        background-color="#2f4050"
        text-color="#fff"
        active-text-color="#ffd04b"
        router
      >
        <el-sub-menu index="1">
          <template #title>基础数据</template>
          <el-menu-item index="/material">物料基础数据</el-menu-item>
          <el-menu-item index="/staff">员工基础数据</el-menu-item>
        </el-sub-menu>
      </el-menu>
    </el-aside>

    <!-- 右侧整体 -->
    <el-container>
      <!-- 顶部工具栏 -->
      <el-header style="text-align: right; font-size: 12px">
        <el-dropdown>
          <i class="el-icon-user"></i> 管理员
          <template #dropdown>
            <el-dropdown-menu>
              <el-dropdown-item>退出登录</el-dropdown-item>
            </el-dropdown-menu>
          </template>
        </el-dropdown>
      </el-header>

      <!-- 中间内容区(页面显示在这里) -->
      <el-main>
        <router-view />
      </el-main>
    </el-container>
  </el-container>
</template>


<script>
export default {
  name: 'TheLayout'
}
</script>


步骤 5:App.vue 只放布局(超级干净)
打开 src/App.vue 全删,替换成:

<template>
  <router-view />
</template>

<script setup>
</script>

步骤 6:启动看效果!

npm run serve

image

image

image

4

5

6

7

8

9

10

11

12

13

14

15

16