[Vuejs]-I want to update the reactive values of Vue.js 3 using a method written in an external file

1👍

Refs when used in the template are automatically unwrapped, meaning your line

@click="increment2(count)"

is equivalent to

@click="increment2(count.value)"

Which is not reactive. What you want to do is send the actual count ref, which can only be done within your <script> tag

import { increment } from "./increment.js";

const increment2 = () => {
  increment(count);
};
<button @click="increment2">Action2</button>
👤yoduh

Leave a comment