This repository has been archived by the owner on Dec 7, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(vuex): dispatch action(#SimulatedGREG/electron-vue#733)
- Loading branch information
Showing
8 changed files
with
156 additions
and
99 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
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,59 +1,83 @@ | ||
<template> | ||
<div> | ||
<div class="title">Information</div> | ||
<input id="input" /> | ||
<!-- <div class="title">Information</div> --> | ||
<div class="title">{{imgUrl}}1{{main}}</div> | ||
<input id="input" | ||
value="" | ||
@keydown="handleKeyDown" /> | ||
|
||
</div> | ||
</template> | ||
|
||
<script> | ||
export default { | ||
name: 'confirm-page', | ||
mounted () { | ||
console.log('mounted confirm page') | ||
}, | ||
beforeUpdate () { | ||
console.log('before update confirm page') | ||
}, | ||
beforeRouteEnter (to, from, next) { | ||
console.log('entered') | ||
next() | ||
export default { | ||
name: 'confirm-page', | ||
mounted () { | ||
console.log('mounted confirm page') | ||
this.$store.dispatch('ConfirmPage/changeImgUrl', | ||
{ imgUrl: 'https://baidu.com' }) | ||
}, | ||
beforeUpdate () { | ||
console.log('before update confirm page') | ||
}, | ||
beforeRouteEnter (to, from, next) { | ||
console.log('entered') | ||
next(vm => { | ||
vm.$store.dispatch('changeImgUrl', { imgUrl: 'https://baidu.com' }) | ||
}) | ||
}, | ||
computed: { | ||
imgUrl: function () { | ||
return this.$store.state.ConfirmPage.imgUrl | ||
}, | ||
data () { | ||
return { | ||
electron: process.versions.electron, | ||
name: this.$route.name, | ||
node: process.versions.node, | ||
path: this.$route.path, | ||
platform: require('os').platform(), | ||
vue: require('vue/package.json').version | ||
} | ||
main: function () { | ||
return this.$store.state.Counter.main | ||
} | ||
}, | ||
methods: { | ||
handleKeyDown: function () { | ||
console.log('oooo') | ||
this.$store.dispatch('changeImgUrlsssss') | ||
} | ||
}, | ||
data () { | ||
return { | ||
electron: process.versions.electron, | ||
name: this.$route.name, | ||
node: process.versions.node, | ||
path: this.$route.path, | ||
platform: require('os').platform(), | ||
vue: require('vue/package.json').version | ||
} | ||
} | ||
} | ||
</script> | ||
|
||
<style scoped> | ||
.title { | ||
color: #888; | ||
font-size: 18px; | ||
font-weight: initial; | ||
letter-spacing: .25px; | ||
margin-top: 10px; | ||
} | ||
.title { | ||
color: #888; | ||
font-size: 18px; | ||
font-weight: initial; | ||
letter-spacing: 0.25px; | ||
margin-top: 10px; | ||
} | ||
.items { margin-top: 8px; } | ||
.items { | ||
margin-top: 8px; | ||
} | ||
.item { | ||
display: flex; | ||
margin-bottom: 6px; | ||
} | ||
.item { | ||
display: flex; | ||
margin-bottom: 6px; | ||
} | ||
.item .name { | ||
color: #6a6a6a; | ||
margin-right: 6px; | ||
} | ||
.item .name { | ||
color: #6a6a6a; | ||
margin-right: 6px; | ||
} | ||
.item .value { | ||
color: #35495e; | ||
font-weight: bold; | ||
} | ||
.item .value { | ||
color: #35495e; | ||
font-weight: bold; | ||
} | ||
</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
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
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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const state = { | ||
imgUrl: 'https://aliook' | ||
} | ||
|
||
const mutations = { | ||
CHANGE_IMG_URL (state, payload) { | ||
console.log('mutations log') | ||
state.imgUrl = 'ok' | ||
} | ||
} | ||
|
||
const actions = { | ||
changeImgUrl ({ commit }, payload) { | ||
// do something async | ||
console.log('aaaaa') | ||
commit('CHANGE_IMG_URL', payload) | ||
} | ||
} | ||
|
||
export default { | ||
state, | ||
mutations, | ||
actions | ||
} |
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