framework7io / framework7-vue

Deprecated! Build full featured iOS & Android apps using Framework7 & Vue
http://framework7.io/vue/
MIT License
674 stars 150 forks source link

Passing data back between pages. #64

Closed shaokun closed 6 years ago

shaokun commented 7 years ago

The F7-Vue router is different from the Vue one, so it's difficult to follow the standard "props down, events up". A developer has to pass data into the next page by using the url query. While in the back direction, it seems no easy way to pass data back to the previous page.

Is there a way to support passing data back to the previous page?

centrual commented 7 years ago

You can use Vuex for that.

red010182 commented 7 years ago

I find that using eventbus could perfectly solve this problem, especially suitable for small applications without using vuex. For example, you can register a global event bus:

Vue.prototype.eventBus = new Vue();

In Vue1 object:

created() {
    this.eventBus.$on('some-event', someFunction); // register observer
},
beforeDestroy() {
    this.eventBus.$off('some-event', someFunction); // remove observer, important
}

In Vue2 object

this.eventBus.$emit('some-event');

reference

nolimits4web commented 6 years ago

Issue is closed because of outdated/irrelevant/not actual

If this issue is still actual and reproducible for latest version of Framework7 & Framework7-Vue, please create new issue and fill the issue template correctly: