Closed zhoufanglu closed 2 years ago
Can you provide me a reproduction demo?
Can you provide me a reproduction demo?
sorry, this is company project, rather old, later i use vue2 syntax
I have the same problem with vue 2 and composition api. But in onMounted hook code runs once.
Is there any progress on this issue? For reproducing, Just create a vue 2 project and write a component in composition API. The setup would be called twice. Below is a simple vue for reproducing this issue:
<script setup lang="ts">
import {ref} from "@vue/composition-api";
const a = ref('aa')
const b = ref('bb')
console.log('call setup')
</script>
<template lang="pug">
span haha {{a}} {{b}}
</template>
hey?
Hey @xiaoxiangmoe ,
i just ran into the exact same issue using vue 2.7.14 and composition-api@1.7.2
here is a Reproduction Demo: https://codesandbox.io/s/confident-architecture-p6jm5p?file=/src/App.vue
Just have a look at the terminal. You'll find Setup being printed twice, mounted only once.
Hi,@marcel-wtfoxtrot In vue 2.7, you needn't use composition-api, just use vue
Have you found the reason?
i install @vue/composition-api at vue 2.6。