Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected mutation of "list" prop #56

Open
AndreiSoroka opened this issue Jul 13, 2023 · 0 comments
Open

Unexpected mutation of "list" prop #56

AndreiSoroka opened this issue Jul 13, 2023 · 0 comments

Comments

@AndreiSoroka
Copy link

AndreiSoroka commented Jul 13, 2023

Hi

<script setup>
  const list = ref([1,2,3])
</script>
<template>
  <Draggable :list="list"> <!-- <<< here -->
  ...

I expect: the list not will be change
Why? Because :list="list" is a prop

If we want to change, should work two ways:

  1. either
  <Draggable v-model="list">
  <Draggable :model-value="list2" @update:model-value="list2 = $event">
  1. or
  <Draggable :list="list" @change="manualChangeList">

but not

  <Draggable :list="list">

https://vuejs.org/guide/components/props.html#one-way-data-flow
I caught unexpected behavior, which gave rise to a couple of bugs in my code that I had to look for

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant