vue.js - Vue 'computed' filters -


is possible pull in variable filter, , have filter update when changes? in computed property?

i'm wanting able like:

vue.filter('t', function(val) {     return this.currentlanguage[val]; }); 

and have filter recompile template when this.currentlanguage changes.

obviously can pass in additional parameter, don't want have each string.

my code works when switching components, alternatively, there way force recompile? i'm using vue-router,

this.$route.router.go({     path: this.$route.router.path,         query: {             t: + new date()          }     }) } 

unfortunately doesn't trigger recompile.

you define reactivity using:

vue.util.definereactive(obj, key, val) 

https://jsfiddle.net/pespantelis/qzuyxqq7/3/

also, have created package that:

https://github.com/pespantelis/vue-localizer


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

android - CoordinatorLayout, FAB and container layout conflict -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -