[Vuejs]-Vue – data reference another data

0👍

model init an object with value.
can set value by default or run func after computed or mounted


data() {
    return {
      somerandom: '',
      someOther: [],
    }
},
computed: {
    useRandom() {
        this.somerandom = this.rand();
    }
},
methods: {
    rand(){
       return 'random';
    }
}

Leave a comment