简体   繁体   中英

location.reload with VueJS

Is there a way to refresh the Current Router View? Something like location.reload(). But not on the whole page, only in the current path name view.

I searched a lot about it and i tried to do

this.$route.router.go

/\ This reloads all the page, not good.

I found a very good possible solution Here . But when i tried it:

vm.$forceupdate

Console.log (vm.$forceUpdate)

ƒ () { var vm = this; if (vm._watcher) { vm._watcher.update(); } }

Yes! ' vm ' is already a global variable. console.log ( vm )

Vue$3 {_uid: 0, _isVue: true, $options: {…}, _renderProxy: Proxy, _self: Vue$3, …}

Nothing happens with this function. Someone knows what is happening or other way to do that?

Thanks!!

Everything which is within data or computed is reactive and will update the view on change. Hence you should store your JSON in data (or if it's used in store - use mapState ). If you need more specific answer - please, provide an example.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM