赞
踩
这里如果提示 ‘vue’ 不是内部或外部命令,也不是可运行的程序,就是没有安装脚手架,还是有问题就是没有安装node.js
// 配置启动端口
module.exports = {
devServer: {
port: 9999
}
}
<template>
<div>
</div>
</template>
<style>
</style>
<template> <div> </div> </template> <script> // import HelloWorld from '@/components/HelloWorld.vue' export default { name: 'HomeView', components: { // HelloWorld } } </script>
<template> <div style="height: 50px; line-height: 50px; border-bottom: 1px solid #ccc; display: flex"> <div style="width: 200px; padding-left: 30px; font-weight: bold; color: dodgerblue">后台管理</div> <div style="flex: 1"></div> <div style="width: 100px">下拉框</div> </div> </template> <script> export default { name: "Header" } </script> <style> </style>
<template> <div> <Header></Header> </div> </template> <style> </style> <script> import Header from "@/components/Header.vue"; export default { name: "Layout", components: { Header } } </script>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
// 引入全局css
import '@/assets/css/global.css'
// 引入element-plus
import ElementPlus from 'element-plus'
// 引入element-plus相关样式
import 'element-plus/dist/index.css'
// 使用组件
createApp(App).use(store).use(router).use(ElementPlus).mount('#app')
<template> <div style="height: 50px; line-height: 50px; border-bottom: 1px solid #ccc; display: flex"> <div style="width: 200px; padding-left: 30px; font-weight: bold; color: dodgerblue">后台管理</div> <div style="flex: 1"></div> <div style="width: 100px"> <el-dropdown> <span class="el-dropdown-link"> tom <el-icon class="el-icon--right"> <arrow-down/> </el-icon> </span> <template #dropdown> <el-dropdown-menu> <el-dropdown-item>个人信息</el-dropdown-item> <el-dropdown-item>退出登录</el-dropdown-item> </el-dropdown-menu> </template> </el-dropdown> </div> </div> </template> <script> export default { name: "Header" } </script> <style> </style>
<script> export default { name: "Aside" } </script> <template> <!-- 引入导航菜单--> <div> <el-menu style="width: 200px" default-active="2" class="el-menu-vertical-demo" > <el-menu-item index="1"> <el-icon><icon-menu /></el-icon> <span>导航一</span> </el-menu-item> <el-menu-item index="2"> <el-icon><icon-menu /></el-icon> <span>导航二</span> </el-menu-item> <el-menu-item index="3" disabled> <el-icon><document /></el-icon> <span>导航三</span> </el-menu-item> <el-menu-item index="4"> <el-icon><setting /></el-icon> <span>导航四</span> </el-menu-item> </el-menu> </div> </template> <style> </style>
<template> <div> <!-- 头部--> <Header></Header> <!-- 主体弹性布局--> <div style="display: flex"> <!-- 侧边栏--> <Aside/> <!-- 路由弹性布局--> <router-view style="flex: 1"/> </div> </div> </template> <style> </style> <script> import Header from "@/components/Header.vue"; import Aside from "@/components/Aside.vue"; export default { name: "Layout", components: { Aside, Header } } </script>
<template> <div> <el-table :data="tableData" stripe style="width: 100%"> <!-- 把width去掉,就会自适应--> <el-table-column prop="date" label="日期"/> <el-table-column prop="name" label="名字"/> <el-table-column prop="address" label="地址" /> </el-table> </div> </template> <script> export default { name: 'HomeView', components: {}, //增加一个data,单项绑定tableData data() { return { tableData: [ { date: '2016-05-03', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, { date: '2016-05-02', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, { date: '2016-05-04', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, { date: '2016-05-01', name: 'Tom', address: 'No. 189, Grove St, Los Angeles', }, ] } } } </script>
<!--在表格的最后一列加入两个超链接-->
<el-table-column fixed="right" label="操作" width="100">
<template #default="scope">
<!-- 插槽机制,点击编辑会将本行的信息传到handleEdit中-->
<el-button @click="handleEdit(scope.row)" type="text">编辑</el-button>
<el-button type="text">删除</el-button>
</template>
</el-table-column>
方法池编写一个空方法
methods: {
handleEdit() {
alert(11)
}
}
<!--增加按钮和搜索框-->
<!--magrin代表上下边距为10px,左右边距为5px-->
<div style="margin: 10px 5px">
<el-button type="primary">新增</el-button>
<el-button>其他</el-button>
</div>
<!--再增加一个搜索框并设置边距-->
<div style="margin: 10px 5px">
<!--搜索框,双向绑定一个search-->
<el-input v-model="search" style="width: 30%" placeholder="请输入关键字"/>
<el-button type="primary">查找</el-button>
</div>
数据池双向绑定搜索框
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。