Answer the question
In order to leave comments, you need to log in
How to compile text into a formula in vue.js?
We need to dynamically compile the vue.js formula based on data from the database.
For example, I get this value from the database {{1+MyParameter[1]}} .
Now the data is displayed "as is" (without recalculation). How can I compile the formula after getting it from the server?
Example
Vue.component('ColFormule', {
props: ['Column'],
template: '{{GetData}}',
computed: {
GetData:{
get: function () {
return this.Column;
}
}
},
} );
Column I stupidly write {{1+1}} , but as a result I get not a calculated value, but the same
Answer the question
In order to leave comments, you need to log in
you can try https://github.com/handsontable/formula-parser
and return the calculation to the computed property
p is paragraph. They cannot be nested.
Something like this: https://jsfiddle.net/t9kk78dv/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question