Company logo
  • Jobs
  • Bootcamp
  • About Us
  • For professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
    • Bootcamp
  • For business
    • Home
    • Our process
    • Plans
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Calculator

0

51
Views
Vue3 - Reactivity not working as expected

There something about Vue3 reactivity that I am not understanding...

<template>
  <Pagination v-model="params" />
</template>

import { defineComponent, reactive, computed } from 'vue'
import { useStore } from 'vuex'

export default defineComponent({
  name: 'Jobs'
  setup(){
    const store = useStore()
    const jobsParams = computed(() => store.getters['Jobs/getParams'])
    const params = reactive(jobsParams) // Should be reactive?

    return { params }
  }
})

I want to get jobs from the store and then 'copy' it to a reactive object called params that I can then manipulate based on a child component.

The error that I am getting when updating the value of params is:

Write operation failed: computed value is readonly

Why would I be getting this error when I am not manipulating those values?

If that is not the way to do this, how can I correctly pass a object to Pagination and update the values accordingly?

5 months ago ยท Juan Pablo Isaza
Answer question
Find remote jobs