init
This commit is contained in:
commit
f628b0cc0f
23
.gitignore
vendored
Normal file
23
.gitignore
vendored
Normal file
@ -0,0 +1,23 @@
|
||||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
pnpm-debug.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
24
README.md
Normal file
24
README.md
Normal file
@ -0,0 +1,24 @@
|
||||
# vue1
|
||||
|
||||
## Project setup
|
||||
```
|
||||
npm install
|
||||
```
|
||||
|
||||
### Compiles and hot-reloads for development
|
||||
```
|
||||
npm run serve
|
||||
```
|
||||
|
||||
### Compiles and minifies for production
|
||||
```
|
||||
npm run build
|
||||
```
|
||||
|
||||
### Lints and fixes files
|
||||
```
|
||||
npm run lint
|
||||
```
|
||||
|
||||
### Customize configuration
|
||||
See [Configuration Reference](https://cli.vuejs.org/config/).
|
5
babel.config.js
Normal file
5
babel.config.js
Normal file
@ -0,0 +1,5 @@
|
||||
module.exports = {
|
||||
presets: [
|
||||
'@vue/cli-plugin-babel/preset'
|
||||
]
|
||||
}
|
12117
package-lock.json
generated
Normal file
12117
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
44
package.json
Normal file
44
package.json
Normal file
@ -0,0 +1,44 @@
|
||||
{
|
||||
"name": "vue1",
|
||||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"serve": "vue-cli-service serve",
|
||||
"build": "vue-cli-service build",
|
||||
"lint": "vue-cli-service lint"
|
||||
},
|
||||
"dependencies": {
|
||||
"core-js": "^3.6.5",
|
||||
"element-ui": "^2.15.5",
|
||||
"vue": "^2.6.11",
|
||||
"vue-router": "^3.5.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vue/cli-plugin-babel": "~4.5.0",
|
||||
"@vue/cli-plugin-eslint": "~4.5.0",
|
||||
"@vue/cli-service": "~4.5.0",
|
||||
"babel-eslint": "^10.1.0",
|
||||
"eslint": "^6.7.2",
|
||||
"eslint-plugin-vue": "^6.2.2",
|
||||
"vue-template-compiler": "^2.6.11"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "babel-eslint"
|
||||
},
|
||||
"rules": {}
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%",
|
||||
"last 2 versions",
|
||||
"not dead"
|
||||
]
|
||||
}
|
BIN
public/favicon.ico
Normal file
BIN
public/favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 4.2 KiB |
17
public/index.html
Normal file
17
public/index.html
Normal file
@ -0,0 +1,17 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1.0">
|
||||
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
|
||||
<title><%= htmlWebpackPlugin.options.title %></title>
|
||||
</head>
|
||||
<body>
|
||||
<noscript>
|
||||
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
|
||||
</noscript>
|
||||
<div id="app"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
32
src/App.vue
Normal file
32
src/App.vue
Normal file
@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view></router-view>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
export default {
|
||||
|
||||
|
||||
components: {
|
||||
|
||||
},
|
||||
methods:{
|
||||
fangfa(aaa,bbb){
|
||||
console.log(aaa,"这是aaa");
|
||||
console.log(bbb,"这是bbb");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.color{
|
||||
background-color: red;
|
||||
}
|
||||
</style>
|
BIN
src/assets/logo.png
Normal file
BIN
src/assets/logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.7 KiB |
17
src/components/HelloWorld.vue
Normal file
17
src/components/HelloWorld.vue
Normal file
@ -0,0 +1,17 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<div></div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'HelloWorld',
|
||||
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
<style scoped>
|
||||
|
||||
</style>
|
26
src/components/st.vue
Normal file
26
src/components/st.vue
Normal file
@ -0,0 +1,26 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>
|
||||
<p>{{name}}</p>
|
||||
<button @click="fangfa">输出</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default{
|
||||
data(){
|
||||
return{
|
||||
name:"aaa",
|
||||
}
|
||||
|
||||
},
|
||||
methods:{
|
||||
fangfa(){
|
||||
this.$emit("ooo","231","456")
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
|
||||
</style>
|
57
src/main.js
Normal file
57
src/main.js
Normal file
@ -0,0 +1,57 @@
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import VueRouter from 'vue-router'
|
||||
import index from "./pages/index.vue"
|
||||
import list from "./pages/list.vue"
|
||||
import ElementUI from 'element-ui';
|
||||
import 'element-ui/lib/theme-chalk/index.css';
|
||||
Vue.use(ElementUI);
|
||||
|
||||
// vue 使用这个插件
|
||||
Vue.use(VueRouter)
|
||||
|
||||
const router = new VueRouter({
|
||||
routes: [{
|
||||
path:"/index",
|
||||
component:index,
|
||||
children:[{
|
||||
path:"table",
|
||||
component: () => import("./pages/table.vue")
|
||||
},{
|
||||
path:"list",
|
||||
component: list
|
||||
}]
|
||||
},{
|
||||
path:"/list",
|
||||
name:"list",
|
||||
component:list
|
||||
},{
|
||||
path:"*",
|
||||
component: ()=> import("./pages/404.vue")
|
||||
}]
|
||||
})
|
||||
// router.beforeEach((diyige,dige,dsf)=>{
|
||||
// // to 到哪个 路由 ==》 即将到的那个页面你的this.$route
|
||||
// // from 来自那个 路由 ==》 跳转的页面的 this.$route
|
||||
// console.log(to,from)
|
||||
// if(to.path == "/index/list"){
|
||||
// // 不谢任何参数 放行
|
||||
// next()
|
||||
|
||||
// }else if (to.fullPath == "/list/table"){
|
||||
// // false 不跳转
|
||||
// next(false)
|
||||
// }else {
|
||||
// // 写路径的 跳转到对应
|
||||
// // push
|
||||
|
||||
// next({path:"/index/list",query:{aa:11}})
|
||||
// }
|
||||
// })
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
render: h => h(App),
|
||||
router:router
|
||||
}).$mount('#app')
|
3
src/pages/404.vue
Normal file
3
src/pages/404.vue
Normal file
@ -0,0 +1,3 @@
|
||||
<template>
|
||||
<div>404</div>
|
||||
</template>
|
109
src/pages/index.vue
Normal file
109
src/pages/index.vue
Normal file
@ -0,0 +1,109 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="aaa">爱仕达大厦</div>
|
||||
<div class="menu" style="width:20%">
|
||||
<el-menu
|
||||
default-active="2"
|
||||
class="el-menu-vertical-demo menu"
|
||||
background-color="#545c64"
|
||||
text-color="#fff"
|
||||
active-text-color="#ffd04b"
|
||||
>
|
||||
<el-submenu index="1" :show-timeout="1000" :hide-timeout="1000">
|
||||
<template slot="title">
|
||||
<i class="el-icon-location"></i>
|
||||
<span>导航一</span>
|
||||
</template>
|
||||
<el-menu-item-group>
|
||||
<template slot="title">分组一</template>
|
||||
<el-menu-item index="1-1">选项1</el-menu-item>
|
||||
<el-menu-item index="1-2">选项2</el-menu-item>
|
||||
</el-menu-item-group>
|
||||
<el-menu-item-group title="分组2">
|
||||
<el-menu-item index="1-3">选项3</el-menu-item>
|
||||
</el-menu-item-group>
|
||||
<el-submenu index="1-4">
|
||||
<template slot="title">选项4</template>
|
||||
<el-menu-item index="1-4-1">选项1</el-menu-item>
|
||||
</el-submenu>
|
||||
</el-submenu>
|
||||
<el-menu-item index="2" @click="tolist">
|
||||
<i class="el-icon-menu"></i>
|
||||
<span slot="title">导航二</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="3" disabled>
|
||||
<i class="el-icon-document"></i>
|
||||
<span slot="title">导航三</span>
|
||||
</el-menu-item>
|
||||
<el-menu-item index="4" @click="totable">
|
||||
<i class="el-icon-setting"></i>
|
||||
<span slot="title">导航四</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
导航栏
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
methods: {
|
||||
tolist() {
|
||||
// js原生 严令禁止
|
||||
// window.location.href = "/#/list"
|
||||
// router
|
||||
this.$router.push("/index/list");
|
||||
// go 前进或者后退
|
||||
|
||||
// this.$router.go(1)
|
||||
// replace 替换上一个页面 上一个页面不出现在历史记录中
|
||||
// this.$router.replace("/list")
|
||||
// push
|
||||
// 跳转页面传参
|
||||
// this.$router.push({
|
||||
// name: "list",
|
||||
// params: {
|
||||
// aaa: 111,
|
||||
// },
|
||||
// });
|
||||
},
|
||||
totable() {
|
||||
// js原生 严令禁止
|
||||
// window.location.href = "/#/list"
|
||||
// router
|
||||
this.$router.push("/index/table");
|
||||
// go 前进或者后退
|
||||
|
||||
// this.$router.go(1)
|
||||
// replace 替换上一个页面 上一个页面不出现在历史记录中
|
||||
// this.$router.replace("/list")
|
||||
// push
|
||||
// 跳转页面传参
|
||||
// this.$router.push({
|
||||
// name: "list",
|
||||
// params: {
|
||||
// aaa: 111,
|
||||
// },
|
||||
// });
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
/* scoped */
|
||||
.aaa{
|
||||
background-color: blue;
|
||||
}
|
||||
.box{
|
||||
display: flex;
|
||||
}
|
||||
.menu{
|
||||
height: 100vh;
|
||||
}
|
||||
.box >>> .el-icon-menu{
|
||||
color: red;
|
||||
}
|
||||
</style>
|
23
src/pages/list.vue
Normal file
23
src/pages/list.vue
Normal file
@ -0,0 +1,23 @@
|
||||
<template>
|
||||
<div class="box">
|
||||
<div class="aaa">这是list</div>
|
||||
<router-link to="/index">dao index</router-link>
|
||||
<button @click="getkey">获取参数</button>
|
||||
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
methods:{
|
||||
getkey(){
|
||||
// route router
|
||||
// 当前页面路由信息
|
||||
// console.log(this.$route)
|
||||
// 全局的路由
|
||||
// console.log(this.$router)
|
||||
let zhi = this.$route.params;
|
||||
console.log(zhi);
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
40
src/pages/table.vue
Normal file
40
src/pages/table.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<el-table :data="tableData" style="width: 100%">
|
||||
<el-table-column prop="date" label="日期" width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="name" label="姓名" width="180">
|
||||
</el-table-column>
|
||||
<el-table-column prop="address" label="地址"> </el-table-column>
|
||||
</el-table>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
tableData: [
|
||||
{
|
||||
date: "2016-05-02",
|
||||
name: "王小虎",
|
||||
address: "上海市普陀区金沙江路 1518 弄",
|
||||
},
|
||||
{
|
||||
date: "2016-05-04",
|
||||
name: "王小虎",
|
||||
address: "上海市普陀区金沙江路 1517 弄",
|
||||
},
|
||||
{
|
||||
date: "2016-05-01",
|
||||
name: "王小虎",
|
||||
address: "上海市普陀区金沙江路 1519 弄",
|
||||
},
|
||||
{
|
||||
date: "2016-05-03",
|
||||
name: "王小虎",
|
||||
address: "上海市普陀区金沙江路 1516 弄",
|
||||
},
|
||||
],
|
||||
};
|
||||
},
|
||||
};
|
||||
</script>
|
Loading…
Reference in New Issue
Block a user