Home > Back-end >  Quasar2 How to load rules from external json file and use them?
Quasar2 How to load rules from external json file and use them?

Time:03-23

I am using Quasar 2 and building components from external JSON file. It works except for :rules. How to effectively read the rules = "[val => val.toString()... || 'Warning....!']" and assign it to the Quasar Vue template? I have tried things like :rules="data.rules", :rules="``${data.rules}``" but haven't had any luck with it so far.

CodePudding user response:

:rules="getRules"

  props: {
    rule: String,
    rules: Array
  },

  computed: {
    getRules() {
      return [eval(this.rule)];
    },

  • Related