vue.jsvue-formulate

Setting value to a computed value


I am trying to set an input value in vue-formulate which is a computed value. The value gets computed (check console) but it is not set as input value.

Reproduction code - https://codesandbox.io/s/vue-formulate-reproduction-template-forked-j9jtc?file=/src/App.vue


Solution

  • You need to v-model the computed property with the FormulateInput instead of one way binding the value. Here codesandbox

    <FormulateInput
                    name="lmp_mcp_difference"
                    type="number"
                    v-model="days_difference"
                    label="Difference of days between LMP and Registration Date"
                  />
    

    For updating the values property you need to assign the values as it has lost reactivity from the vue instance.Updated codesandbox