1

There is a method that returns true or false:

canEdit() {
  if (this.$route.params.edit === "edit") {
    return true;
  }
},

How do I get the v-model attribute to have the appropriate variable depending on what the canEdit method returns?

<b-form-input id="sender" v-model="sender"> </b-form-input>
Alex
  • 25
  • 1
  • 8
  • where `canEdit` is being called? – ma_jafari Sep 23 '20 at 07:32
  • @ma_jafari, this method is called in: methods: { canEdit() { if (this.$route.params.edit === "edit") { return true; } } } – Alex Sep 23 '20 at 07:36
  • @hgb123, it doesn't work, error: 'v-model' directives require the attribute value which is valid as LHS vue/valid-v-model – Alex Sep 23 '20 at 07:38
  • you have defined `canEdit` in methods, where did you used it? for example will it be called if a specific action is done(like clicking a button) or in a vue life cycles(like `mounted`)? – ma_jafari Sep 23 '20 at 07:41
  • @ma_jafari this is the method I use in mounted () to check if the form is editable. – Alex Sep 23 '20 at 07:51

0 Answers0