Reputation: 1253
I am building an application with vuejs
I have a ref which contains an array and I want to update a single value inside it
export default defineComponent({
setup() {
const allQuestions = ref([{"like" => 1},{"like" => 0}]);
allQuestions.value[1].like = 1;
}
}
I want to update the second like in the ref array.
Upvotes: 2
Views: 5182
Reputation: 29091
Javascript uses a different syntax than php for objects.
const allQuestions = ref([{like:1},{like:0}]);
allQuestions.value[1].like = 1
Upvotes: 5