2022-11-29 06:29:26 +00:00
|
|
|
<!--
|
|
|
|
* @Author: Kane
|
|
|
|
* @Date: 2022-11-22 17:50:49
|
|
|
|
* @LastEditors: Kane
|
2022-11-29 12:23:35 +00:00
|
|
|
* @LastEditTime: 2022-11-29 17:50:22
|
2022-11-29 06:29:26 +00:00
|
|
|
* @FilePath: \hello-cli\src\App.vue
|
|
|
|
* @Description:
|
|
|
|
*
|
|
|
|
* Copyright (c) ${2022} by Kane, All Rights Reserved.
|
|
|
|
-->
|
2022-11-22 09:57:20 +00:00
|
|
|
<template>
|
2022-11-29 06:29:26 +00:00
|
|
|
<div class="content">
|
2022-11-29 12:23:35 +00:00
|
|
|
<h1>学习vuex</h1>
|
|
|
|
<div><App1></App1> <App2></App2></div>
|
|
|
|
<el-button type="warning" @click="onClearCount">清零</el-button>
|
2022-11-29 06:29:26 +00:00
|
|
|
</div>
|
2022-11-29 12:23:35 +00:00
|
|
|
<hr />
|
2022-11-22 09:57:20 +00:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2022-11-29 06:29:26 +00:00
|
|
|
import App1 from "./components/vuex/App1.vue";
|
|
|
|
import App2 from "./components/vuex/App2.vue";
|
2022-11-22 09:57:20 +00:00
|
|
|
|
|
|
|
export default {
|
2022-11-29 06:29:26 +00:00
|
|
|
name: "App",
|
2022-11-22 09:57:20 +00:00
|
|
|
components: {
|
2022-11-29 06:29:26 +00:00
|
|
|
App1,
|
|
|
|
App2,
|
|
|
|
},
|
2022-11-29 12:23:35 +00:00
|
|
|
methods: {
|
|
|
|
onClearCount() {
|
|
|
|
this.$store.commit("clearCount");
|
|
|
|
},
|
|
|
|
},
|
2022-11-29 06:29:26 +00:00
|
|
|
};
|
2022-11-22 09:57:20 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
#app {
|
2022-11-29 12:23:35 +00:00
|
|
|
background-color: #f4f5f7;
|
|
|
|
}
|
|
|
|
.content {
|
2022-11-29 06:29:26 +00:00
|
|
|
display: flex;
|
2022-11-29 12:23:35 +00:00
|
|
|
flex-direction: column;
|
2022-11-29 06:29:26 +00:00
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
|
|
|
width: 40rem;
|
|
|
|
margin: 0px auto;
|
|
|
|
border-radius: 5px;
|
|
|
|
padding: 50px;
|
|
|
|
}
|
|
|
|
|
|
|
|
#app div {
|
|
|
|
padding: 15px;
|
|
|
|
}
|
|
|
|
|
|
|
|
#app div > * + * {
|
|
|
|
margin-left: 1rem;
|
2022-11-22 09:57:20 +00:00
|
|
|
}
|
2022-11-29 12:23:35 +00:00
|
|
|
|
|
|
|
hr {
|
|
|
|
width: 100%;
|
|
|
|
border: 1px solid 1px;
|
|
|
|
}
|
2022-11-22 09:57:20 +00:00
|
|
|
</style>
|