or even npm.npm put in vue-bind-once-- save.Register directive.import createApp coming from 'vue'.import App from './ App.vue'.import BindOnceDirective, BindOncePlugin coming from 'vue-bind-once'.const app = createApp( App).app.use( BindOncePlugin).// or app.directive(' bind-once', BindOnceDirective).In many cases you'll be actually using this directive with an SSR-rendering framework like nuxt, which may possess a various technique for you to register this directive. As an example, in a Nuxt plugin:.import BindOncePlugin coming from 'vue-bind-once'.export default defineNuxtPlugin( nuxtApp => nuxtApp.vueApp.use( BindOncePlugin). ).Utilization.You can easily now use the regulation on any element where you need to have a binding to a market value that needs to have to match between client/server yet won't change dynamically afterwards.
This are going to deal with both web server and on client re-hydration.