-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
63 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,44 @@ | ||
<template> | ||
<div class="page"> | ||
vuexPageB | ||
<div class="page__bd page__bd_spacing"> | ||
<div class="mpvueInfo-desc">{{mpvueInfo}}</div> | ||
<button type="primary" class="mt-15" @click="commitMpvueInfo">再次更新 state => mpvueInfo</button> | ||
</div> | ||
</div> | ||
</template> | ||
|
||
<script> | ||
import { mapGetters } from 'vuex'; | ||
import { mapGetters, mapMutations } from 'vuex'; | ||
export default { | ||
mounted() { | ||
console.log(this.userinfo); | ||
console.log(this.mpvueInfo); | ||
}, | ||
computed: { | ||
...mapGetters([ | ||
'userinfo' | ||
'mpvueInfo' | ||
]) | ||
}, | ||
methods: { | ||
...mapMutations({ | ||
setMpvueInfoVuex: 'SET_MPVUEINFO' | ||
}), | ||
commitMpvueInfo() { | ||
let mpvueInfoUpate = '基于 Vue.js 的小程序开发框架,从底层支持 Vue.js 语法和构建工具体系。---created by美团点评,github 地址:https://github.com/Meituan-Dianping/mpvue' | ||
this.setMpvueInfoVuex(mpvueInfoUpate); | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style> | ||
.mpvueInfo-desc { | ||
margin-top: 15px; | ||
font-size: 18px; | ||
color: #333; | ||
text-align: justify; | ||
word-break: break-all; | ||
} | ||
.mt-15 { | ||
margin-top: 30px; | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
export const userinfo = state => state.userinfo; | ||
export const mpvueInfo = state => state.mpvueInfo; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
// mutation 常量 | ||
|
||
export const SET_USERINFO = 'SET_USERINFO'; | ||
export const SET_MPVUEINFO = 'SET_MPVUEINFO'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
const state = { | ||
userinfo: { | ||
'name': 'mpvue' | ||
} | ||
mpvueInfo: '基于 Vue.js 的小程序开发框架,从底层支持 Vue.js 语法和构建工具体系。' | ||
} | ||
|
||
export default state; |