[Vuejs]-Keep iframe content in vue component

0๐Ÿ‘

โœ…

If the sub component approach works for you:

<Component v-if="$store.state.isShow"></Component>

then a slight modification will keep the iframe from being refreshed on state changes:

<Component v-show="$store.state.isShow"></Component>

Note that this only works if the route remains unchanged.

If you actually need to use different routes, and if the only problem with refreshing the iframe is performance, you might be able to get away with loading the iframe contents via ajax and caching it in local storage.

๐Ÿ‘คStephen Thomas

Leave a comment