first commit

This commit is contained in:
Savior
2022-03-08 14:53:48 +08:00
commit de235efdc9
19 changed files with 19814 additions and 0 deletions

61
src/App.vue Normal file
View File

@@ -0,0 +1,61 @@
// .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>
* {
margin: 0;
padding: 0;
}
</style>

BIN
src/assets/logo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

View 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
View File

@@ -0,0 +1,14 @@
<template>
<div>
<div>这是aaaa</div>
</div>
</template>
<script>
export default {
name:"AaaCom"
}
</script>

40
src/components/zujian.vue Normal file
View 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>

56
src/main.js Normal file
View File

@@ -0,0 +1,56 @@
// 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';
Vue.use(ElementUI);
// vuerouter 插件
Vue.use(VueRouter)
// 路径 => 页面(组件)
const routes = [{
path:"/abc",
component:HelloWorld
},{
path:"/agfahg",
component:aaa
},
{
path:"/nav",
component:() => import("./pages/nav.vue"),
children:[{
path:"user",
component: () => import("./pages/user.vue")
// path:"/user",
// component: () => import("./pages/user.vue")
// 加了'/'就是绝对路径 后面不需要写父级路径 @click="$router.push('/user')"
// 不加'/'就是相对路径 后面就需要写父级路径 @click="$router.push('/nav/user')
},
{
path:"/",
component: index
},
],
}
]
const router = new VueRouter({
routes // (缩写) 相当于 routes: routes
})
Vue.config.productionTip = false
new Vue({
render: h => h(App),
router
}).$mount('#aaa')

15
src/pages/index.vue Normal file
View File

@@ -0,0 +1,15 @@
<template>
<div>
这是首页
</div>
</template>
<script>
export default {
name:"PageIndex",
}
</script>
<style>
</style>

59
src/pages/nav.vue Normal file
View File

@@ -0,0 +1,59 @@
<template>
<div class="nav">
<div style="width:256px">
<el-menu
default-active="2"
class="el-menu-vertical-demo"
@open="handleOpen"
@close="handleClose"
background-color="#545c64"
text-color="#fff"
active-text-color="#ffd04b"
style="height: 100vh;">
<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">选项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="$router.push('/nav')">
<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="$router.push('/nav/user')">
<i class="el-icon-setting"></i>
<span slot="title">导航四</span>
</el-menu-item>
</el-menu>
</div>
<div style="width: 100%">
<router-view></router-view>
</div>
</div>
</template>
<script>
export default {
name:"navPage",
}
</script>
<style scoped>
.nav {
display: flex;
}
</style>

30
src/pages/user.vue Normal file
View 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>