lx
This commit is contained in:
commit
d985fd26f8
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 @@
|
||||
# wodexiangmu
|
||||
|
||||
## 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'
|
||||
]
|
||||
}
|
19
jsconfig.json
Normal file
19
jsconfig.json
Normal file
@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"target": "es5",
|
||||
"module": "esnext",
|
||||
"baseUrl": "./",
|
||||
"moduleResolution": "node",
|
||||
"paths": {
|
||||
"@/*": [
|
||||
"src/*"
|
||||
]
|
||||
},
|
||||
"lib": [
|
||||
"esnext",
|
||||
"dom",
|
||||
"dom.iterable",
|
||||
"scripthost"
|
||||
]
|
||||
}
|
||||
}
|
19343
package-lock.json
generated
Normal file
19343
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
45
package.json
Normal file
45
package.json
Normal file
@ -0,0 +1,45 @@
|
||||
{
|
||||
"name": "wodexiangmu",
|
||||
"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.8.3",
|
||||
"element-ui": "^2.15.6",
|
||||
"vue": "^2.6.14",
|
||||
"vue-router": "^3.5.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.12.16",
|
||||
"@babel/eslint-parser": "^7.12.16",
|
||||
"@vue/cli-plugin-babel": "~5.0.0",
|
||||
"@vue/cli-plugin-eslint": "~5.0.0",
|
||||
"@vue/cli-service": "~5.0.0",
|
||||
"eslint": "^7.32.0",
|
||||
"eslint-plugin-vue": "^8.0.3",
|
||||
"vue-template-compiler": "^2.6.14"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"root": true,
|
||||
"env": {
|
||||
"node": true
|
||||
},
|
||||
"extends": [
|
||||
"plugin:vue/essential",
|
||||
"eslint:recommended"
|
||||
],
|
||||
"parserOptions": {
|
||||
"parser": "@babel/eslint-parser"
|
||||
},
|
||||
"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="aaa"></div>
|
||||
<!-- built files will be auto injected -->
|
||||
</body>
|
||||
</html>
|
57
src/App.vue
Normal file
57
src/App.vue
Normal file
@ -0,0 +1,57 @@
|
||||
// .vue 文件 vue 的组件
|
||||
// html css js
|
||||
|
||||
//
|
||||
|
||||
|
||||
// 组件
|
||||
|
||||
//
|
||||
<template>
|
||||
<div class="aaaa">
|
||||
|
||||
<router-view></router-view>
|
||||
<!-- 监听子组件的事件 -->
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// 导出
|
||||
// new Vue
|
||||
// 组件
|
||||
// data:{
|
||||
// name:"这是name"
|
||||
// }
|
||||
export default {
|
||||
name: 'App',
|
||||
// 注册组件
|
||||
components:{
|
||||
},
|
||||
methods: {
|
||||
dianwo() {
|
||||
// alert("事件")
|
||||
this.name = "这是新的sname"
|
||||
},
|
||||
aaa(canshu,canshuer,canshusan){
|
||||
console.log("子组件被点击了")
|
||||
console.log("传过来的值是",canshu)
|
||||
console.log("传过来的值2是",canshuer)
|
||||
console.log("传过来的值3是",canshusan)
|
||||
},
|
||||
zijideshijian(xingcan,xingcan2){
|
||||
console.log("事件被触发了")
|
||||
console.log(xingcan)
|
||||
console.log(xingcan2)
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
name: "这是name",
|
||||
jiage:0
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</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 |
59
src/components/HelloWorld.vue
Normal file
59
src/components/HelloWorld.vue
Normal file
@ -0,0 +1,59 @@
|
||||
<template>
|
||||
<div class="hello">
|
||||
<h1>{{ msg }}</h1>
|
||||
<p>
|
||||
这是hello world
|
||||
<a href="https://cli.vuejs.org" target="_blank" rel="noopener">vue-cli documentation</a>.
|
||||
</p>
|
||||
<h3>Installed CLI Plugins</h3>
|
||||
<ul>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-babel" target="_blank" rel="noopener">babel</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-cli/tree/dev/packages/%40vue/cli-plugin-eslint" target="_blank" rel="noopener">eslint</a></li>
|
||||
</ul>
|
||||
<h3>Essential Links</h3>
|
||||
<ul>
|
||||
<li><a href="https://vuejs.org" target="_blank" rel="noopener">Core Docs</a></li>
|
||||
<li><a href="https://forum.vuejs.org" target="_blank" rel="noopener">Forum</a></li>
|
||||
<li><a href="https://chat.vuejs.org" target="_blank" rel="noopener">Community Chat</a></li>
|
||||
<li><a href="https://twitter.com/vuejs" target="_blank" rel="noopener">Twitter</a></li>
|
||||
<li><a href="https://news.vuejs.org" target="_blank" rel="noopener">News</a></li>
|
||||
</ul>
|
||||
<h3>Ecosystem</h3>
|
||||
<ul>
|
||||
<li><a href="https://router.vuejs.org" target="_blank" rel="noopener">vue-router</a></li>
|
||||
<li><a href="https://vuex.vuejs.org" target="_blank" rel="noopener">vuex</a></li>
|
||||
<li><a href="https://github.com/vuejs/vue-devtools#vue-devtools" target="_blank" rel="noopener">vue-devtools</a></li>
|
||||
<li><a href="https://vue-loader.vuejs.org" target="_blank" rel="noopener">vue-loader</a></li>
|
||||
<li><a href="https://github.com/vuejs/awesome-vue" target="_blank" rel="noopener">awesome-vue</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
// 组件的名子
|
||||
name: 'HelloWorld',
|
||||
props: {
|
||||
msg: String
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<!-- Add "scoped" attribute to limit CSS to this component only -->
|
||||
// 后面会有影响
|
||||
<style scoped>
|
||||
h3 {
|
||||
margin: 40px 0 0;
|
||||
}
|
||||
ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 0 10px;
|
||||
}
|
||||
a {
|
||||
color: #42b983;
|
||||
}
|
||||
</style>
|
14
src/components/aaa.vue
Normal file
14
src/components/aaa.vue
Normal file
@ -0,0 +1,14 @@
|
||||
<template>
|
||||
<div>
|
||||
<div>这是aaaa</div>
|
||||
|
||||
</div>
|
||||
|
||||
</template>
|
||||
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"AaaCom"
|
||||
}
|
||||
</script>
|
69
src/components/luyou.vue
Normal file
69
src/components/luyou.vue
Normal file
@ -0,0 +1,69 @@
|
||||
<template>
|
||||
<div style="display: flex;">
|
||||
<el-row class="tac" style="width:30%">
|
||||
<el-col :span="12">
|
||||
<h5>自定义颜色</h5>
|
||||
<el-menu
|
||||
default-active="2"
|
||||
class="el-menu-vertical-demo"
|
||||
@open="handleOpen"
|
||||
@close="handleClose"
|
||||
background-color="#545c64"
|
||||
text-color="#fff"
|
||||
active-text-color="#ffd04b">
|
||||
<el-submenu index="1">
|
||||
<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" @click="$router.push('/login/abc')">选项1</el-menu-item>
|
||||
<el-menu-item index="1-2" @click="$router.push('/login/user')">选项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">
|
||||
<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">
|
||||
<i class="el-icon-setting"></i>
|
||||
<span slot="title">导航四</span>
|
||||
</el-menu-item>
|
||||
</el-menu>
|
||||
</el-col>
|
||||
</el-row>
|
||||
<div>
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "luiYou",
|
||||
methods: {
|
||||
handleClose(key, keyPath) {
|
||||
console.log(key, keyPath);
|
||||
},
|
||||
toindex(){
|
||||
|
||||
},
|
||||
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
</style>
|
40
src/components/zujian.vue
Normal file
40
src/components/zujian.vue
Normal file
@ -0,0 +1,40 @@
|
||||
<template>
|
||||
<div>
|
||||
商品
|
||||
计数: {{count}}
|
||||
<button @click="dianwo">点我</button>
|
||||
<button @click="jian">减</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"ZuJian",
|
||||
data(){
|
||||
return {
|
||||
count:0
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
dianwo(){
|
||||
// console.log("事件触发")
|
||||
this.count++
|
||||
// vue 自带的
|
||||
// 父传子 属性
|
||||
// 子传父 事件
|
||||
// 触发 父级的事件
|
||||
this.$emit("abc",this.count,"第二个参数")
|
||||
// 子传父
|
||||
// this.$emit("aaa",2222,1111,6666)
|
||||
},
|
||||
jian(){
|
||||
this.count--
|
||||
// this.$emit("aaa",this.count)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
49
src/main.js
Normal file
49
src/main.js
Normal file
@ -0,0 +1,49 @@
|
||||
// js 导入 模块式开发
|
||||
|
||||
import Vue from 'vue'
|
||||
// 导入 App.vue
|
||||
import App from './App.vue'
|
||||
// import zujian from "./components/zujian.vue"
|
||||
import HelloWorld from "./components/HelloWorld.vue"
|
||||
import aaa from "./components/aaa.vue"
|
||||
import VueRouter from "vue-router"
|
||||
import index from "./pages/index.vue"
|
||||
import ElementUI from "element-ui";
|
||||
import "element-ui/lib/theme-chalk/index.css";
|
||||
|
||||
|
||||
// vuerouter 插件
|
||||
Vue.use(ElementUI);
|
||||
Vue.use(VueRouter)
|
||||
// 路径 => 页面(组件)
|
||||
const routes = [{
|
||||
path:"/abc",
|
||||
component:HelloWorld
|
||||
},{
|
||||
path:"/agfahg",
|
||||
component:aaa
|
||||
}, {
|
||||
path:"/",
|
||||
component: index
|
||||
}, {
|
||||
path:"/login",
|
||||
component:() =>import("./components/luyou.vue"),
|
||||
children:[{
|
||||
path:"user",
|
||||
component: () => import("./pages/user.vue")
|
||||
},{
|
||||
path:"abc",
|
||||
component:HelloWorld
|
||||
}]
|
||||
}]
|
||||
|
||||
const router = new VueRouter({
|
||||
routes // (缩写) 相当于 routes: routes
|
||||
})
|
||||
|
||||
Vue.config.productionTip = false
|
||||
|
||||
new Vue({
|
||||
render: h => h(App),
|
||||
router
|
||||
}).$mount('#aaa')
|
72
src/pages/index.vue
Normal file
72
src/pages/index.vue
Normal file
@ -0,0 +1,72 @@
|
||||
<template>
|
||||
<div>
|
||||
这是首页
|
||||
<!-- <a href="/#/user">到user</a> -->
|
||||
<!-- vue router 中 跳转页面 用router-link -->
|
||||
<!-- 声明式导航 -->
|
||||
用户名:<input v-model="user" type="text" name="" id="">
|
||||
<router-link to="/user">到user</router-link>
|
||||
<!-- 编程式导航 -->
|
||||
<!-- js 跳转 -->
|
||||
<!-- 事件 -->
|
||||
<button @click="touser">点我跳转到user</button>
|
||||
<button @click="back">返回上一页</button>
|
||||
<button @click="next">去下一页</button>
|
||||
<button @click="list.reverse()">反转数组</button>
|
||||
<ul class="app">
|
||||
<li v-for="(item,index) in list" :key="index"><span>{{item.name}}</span><input type="text" name="" id=""></li>
|
||||
</ul>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"PageIndex",
|
||||
data(){
|
||||
return {
|
||||
user:"",
|
||||
list:[{
|
||||
name:"小白",age:16
|
||||
},{
|
||||
name:"小明",age:18
|
||||
},]
|
||||
}
|
||||
},
|
||||
methods:{
|
||||
chuancan(index){
|
||||
this.$router.push({
|
||||
path:"user",
|
||||
query:{
|
||||
canshuming:this.list[index]
|
||||
}
|
||||
})
|
||||
},
|
||||
touser(){
|
||||
//
|
||||
// location.href = "/user"
|
||||
// vuerouter
|
||||
// this.$router.push("/user?user=" + this.user)
|
||||
this.$router.push({
|
||||
path:"/user",
|
||||
query:{
|
||||
canshuming:this.user,
|
||||
canshuer:123456
|
||||
}
|
||||
})
|
||||
// 传参
|
||||
// this.$router.push({path:"/user"})
|
||||
// this.$router.replace("/user")
|
||||
},
|
||||
back(){
|
||||
// 前进 后退
|
||||
this.$router.go(-1)
|
||||
},
|
||||
next(){
|
||||
this.$router.go(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
30
src/pages/user.vue
Normal file
30
src/pages/user.vue
Normal file
@ -0,0 +1,30 @@
|
||||
<template>
|
||||
<div>这是user
|
||||
<button @click="back" class="app">返回上一页</button>
|
||||
<button @click="next">去下一页</button>
|
||||
<button @click="getquery" >获取传参</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name:"PageUser",
|
||||
methods:{
|
||||
back(){
|
||||
this.$router.go(-4)
|
||||
},
|
||||
next(){
|
||||
this.$router.go(1)
|
||||
},
|
||||
getquery(){
|
||||
console.log(this.$route.query.canshuming)
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.app{
|
||||
background-color: aqua;
|
||||
}
|
||||
</style>
|
4
vue.config.js
Normal file
4
vue.config.js
Normal file
@ -0,0 +1,4 @@
|
||||
const { defineConfig } = require('@vue/cli-service')
|
||||
module.exports = defineConfig({
|
||||
transpileDependencies: true
|
||||
})
|
Loading…
Reference in New Issue
Block a user