保存进度!
This commit is contained in:
25
入门/cli/hello-cli/src/components/AppBanner.vue
Normal file
25
入门/cli/hello-cli/src/components/AppBanner.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
* @Author: Kane
|
||||
* @Date: 2022-12-02 22:44:12
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-12-02 22:47:10
|
||||
* @FilePath: \hello-cli\src\components\banner.vue
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
-->
|
||||
<template>
|
||||
<h1><slot>AppBanner</slot></h1>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "AppBanner",
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
25
入门/cli/hello-cli/src/components/AppNav.vue
Normal file
25
入门/cli/hello-cli/src/components/AppNav.vue
Normal file
@@ -0,0 +1,25 @@
|
||||
<!--
|
||||
* @Author: Kane
|
||||
* @Date: 2022-12-02 22:50:54
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-12-02 22:56:40
|
||||
* @FilePath: \hello-cli\src\components\AppNav.vue
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
-->
|
||||
<template>
|
||||
<div></div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "AppNav",
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
@@ -1,45 +0,0 @@
|
||||
<!--
|
||||
* @Author: Kane
|
||||
* @Date: 2022-11-29 11:36:29
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-11-29 15:51:01
|
||||
* @FilePath: \hello-cli\src\components\vuex\App1.vue
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
-->
|
||||
<template>
|
||||
<div class="container">
|
||||
<h1>计数器一:{{ storeCount }}</h1>
|
||||
<el-button type="primary" v-on:click="addCount()">更新计数器</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { mapState } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "App-1",
|
||||
data() {
|
||||
return {
|
||||
count: 0,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
addCount() {
|
||||
this.$store.commit("increment");
|
||||
},
|
||||
},
|
||||
computed: mapState({
|
||||
storeCount: "count",
|
||||
}),
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.container {
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
background-color: #fff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
@@ -1,49 +0,0 @@
|
||||
<!-- eslint-disable no-unused-vars -->
|
||||
<!--
|
||||
* @Author: Kane
|
||||
* @Date: 2022-11-29 13:10:21
|
||||
* @LastEditors: Kane
|
||||
* @LastEditTime: 2022-11-29 16:07:22
|
||||
* @FilePath: \hello-cli\src\components\vuex\App2.vue
|
||||
* @Description:
|
||||
*
|
||||
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
||||
-->
|
||||
<template>
|
||||
<div class="container">
|
||||
<h1>计数器二:{{ this.$store.getters.countText }}</h1>
|
||||
<el-button type="danger" v-on:click="addCount()">更新计数器</el-button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
//引入mapState
|
||||
//import { mapState } from "vuex";
|
||||
|
||||
export default {
|
||||
name: "App-2",
|
||||
data() {
|
||||
return {
|
||||
count: 0,
|
||||
};
|
||||
},
|
||||
methods: {
|
||||
addCount() {
|
||||
this.$store.commit("increment");
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
storeCount() {
|
||||
return this.$store.state.count;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
<style scoped>
|
||||
.container {
|
||||
text-align: center;
|
||||
display: inline-block;
|
||||
background-color: #fff;
|
||||
border-radius: 5px;
|
||||
}
|
||||
</style>
|
Reference in New Issue
Block a user