
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
keep-alive-vue3
Advanced tools
Extend vue3 keep-alive and router-view, add the function of automatically judging whether to use the cache. Support for vue2 [Click here](https://github.com/deep-fish-pixel/keep-alive-vue2)
Extend vue3 keep-alive and router-view, add the function of automatically judging whether to use the cache. Support for vue2 Click here
If the page uses keep-alive and router-view, the advantage is that the operation state of the previous step is quickly restored when the next page operation returns, and this experience is very good.
But it also brings problems.
When the user enters the page from the navigation menu or breadcrumb, a brand new page is needed, but the cached page is actually used, and this result is not what we want.
keep-alive-vue3 solves this problem.
It uses the cache when you operate $router.back and $router.go to return the page by default, and $router.push does not use the cache by default.
npm i keep-alive-vue3
import KeepAliveVue3 from 'keep-alive-vue3';
createApp(App).use(router).use(KeepAliveVue3)
keep-alive-vue3 encapsulates keep-alive and router-view internally,
so you only need to write the keep-alive-vue3 component element.
The cached attribute is used to cache the use of page caching.
<div id="app">
<keep-alive-vue3 :cached="$route.meta.keepAlive" />
</div>
property | description | type | option | default |
---|---|---|---|---|
cached | whether to disable page caching | Boolean | true/false | false |
name | router-view name | String | - | - |
include | only components with matching names will be cached | RegExp | - | - |
exclude | any component whose name matches will not be cached | RegExp | - | - |
max | maximum number of component instances that can be cached | Number | - | - |
The page displayed by the push interface does not use the cache function by default. If you need to use it, configure cached to true
this.$router.push({
name: 'list',
cached: true
});
The page displayed by the back interface uses the cache function by default. If disabled, configure cached to false
this.$router.back({
cached: false
});
The page displayed by the go interface uses the cache function by default when it is less than 0, and the cache is prohibited by default when it is greater than 0. If disabled, configure cached to false
this.$router.go(-1, {
cached: false
});
FAQs
Extend vue3 keep-alive and router-view, add the function of automatically judging whether to use the cache.
The npm package keep-alive-vue3 receives a total of 2 weekly downloads. As such, keep-alive-vue3 popularity was classified as not popular.
We found that keep-alive-vue3 demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.