Skip to content

Commit

Permalink
fix: replace router.place with window.open new tab to aviod could not…
Browse files Browse the repository at this point in the history
… save and preview the work when create the work

zh: 用 window.open new tab 替换 router.replace,避免最创建作品保存和预览无效的情况
  • Loading branch information
ly525 committed Dec 8, 2019
1 parent 1dcef06 commit cf953c2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 17 deletions.
11 changes: 2 additions & 9 deletions front-end/h5/src/store/modules/work.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,9 @@ export const actions = {
},
createWork ({ commit }, payload) {
strapi.createEntry('works', new Work()).then(entry => {
commit('setWork', entry)
router.replace({ name: 'editor', params: { workId: entry.id } })
// window.location = `${window.location.origin}/#/editor/${entry.id}`
const routeData = router.resolve({ name: 'editor', params: { workId: entry.id } })
window.open(routeData.href, '_blank')
})
// commit('createWork')
// commit('pageManager', { type: 'add' })
// commit('setEditingPage')
},
updateWork ({ commit, state }, payload = {}) {
// update work with strapi
Expand Down Expand Up @@ -248,9 +244,6 @@ export const mutations = {
})
state.work = work
},
// createWork (state) {
// state.work = new Work()
// },
previewWork (state, { type, value }) {},
deployWork (state, { type, value }) {},
formDetailOfWork (state, { type, value }) {
Expand Down
6 changes: 2 additions & 4 deletions front-end/h5/src/views/work-manager/list.vue
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,11 @@ export default {
},
methods: {
...mapActions('editor', [
'fetchWorks'
'fetchWorks',
'createWork'
]),
deleteWork (item) {
// TODO delete work from work list
},
createWork () {
this.$router.push({ name: 'editor' })
}
},
render (h) {
Expand Down
4 changes: 0 additions & 4 deletions front-end/h5/src/views/work-manager/templates.vue
Original file line number Diff line number Diff line change
Expand Up @@ -104,10 +104,6 @@ export default {
]),
deleteWork (item) {
// TODO delete work from work list
},
createWork () {
this.$router.push({ name: 'editor' })
// window.open('#/editor', '_blank')
}
},
render (h) {
Expand Down

0 comments on commit cf953c2

Please sign in to comment.