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

proxy not contain a compoennt value on the prod env(dev is ok) #7098

Closed
pk8848597 opened this issue Nov 11, 2022 · 2 comments
Closed

proxy not contain a compoennt value on the prod env(dev is ok) #7098

pk8848597 opened this issue Nov 11, 2022 · 2 comments
Labels
🐞 bug Something isn't working

Comments

@pk8848597
Copy link

Vue version

3.2.37

Link to minimal reproduction

https://sfc.vuejs.org/#__DEV__eNq1U0tu1EAQvUrhjT1i7FYmC6SRPQRlAwt2SGx6Y+yascH9UXd7CLJ8Ec7CnbgC1W7HmcwgIiJl5/r0e1WvnofondbZscdoG+W2Mq12YNH1esdlK7QyDgYwuF/DAd1tbwxK90FaV8oKYYS9UQJieh4v7VXTdvXVXMlYCD0DtVSKnoKwByg8aBK/x65T8FmZrn4Vr7jMWZiB2ClwKHRXOqQIIG+udsMwPR7HnFE0ZVupewfHVKgau4JHVOdRKAXqXT7PQMmcLZDROgoDp6LU2VerJCkw+Hd8LlgebWHK+Bwt4GMeNc5pu2Wsl/rbIauUYDdUY6aXrhWY1krcXGeb7PoNq1vrTvMZWpF+Meq7RUOMPFqfgDNKHtGkJHCNBs0/yc56HxGe1S5IPefI5UgCPNzmyesr+VHRJlj//egD9BZvPdxSp9MrIZQk0jNzbB6bYzObg4SYDTLAvpcEVCyoCXnjwjyfmtZCa3//+umtw+UyY5KsoNh5kCQOO8arqeP/7RUmZBfeWXYj5RYNnvxFuMS7qZdGq1yr5MmCwWr3Amij7n5MElyCejHgAcKvKUuBM0LAUB1mnTokcVPaaam38Rpi+oihlQF9QoHwnfmW1wV4nNkgQCK73sh7VKI5t850uRe3zgv6YvM8X5xaYfwDNIbPsg==

Steps to reproduce

common.js :

import { getCurrentInstance } from 'vue'

export function useChild() {
  const { proxy } = getCurrentInstance()
  function fun(name) {
    console.log('has msg ?', 'msg' in proxy)
    proxy.msg += name
  }
  return {
    fun
  }
}

app.vue :

<script setup>
import { ref, getCurrentInstance } from 'vue'
import child1 from './child1.vue'
const msg = ref('Hello World!')
</script>

<template>
  <h1>{{ msg }}</h1>
  <input v-model="msg">
  <child1></child1>
</template>

child1.vue :

<script setup>
import { ref, onMounted } from 'vue'
import { useChild } from './common.js'
import child2 from './child2.vue'
  
const { fun } = useChild()
const msg = ref('This is:')

onMounted(() => fun('child1'))

</script>

<template>
  <h1>{{ msg }}</h1>
  <child2/>
</template>

What is expected?

in prod env, The proxy contain msg

What is actually happening?

in prod env, The proxy not contain msg

System Info

No response

Any additional comments?

No response

@pk8848597
Copy link
Author

add:

//work in this case
<script lang="ts">
   setup() {
     // do something.....
   }
</script>
// not work
<script lang="ts" setup>
</script>

@zhangzhonghe zhangzhonghe added the 🐞 bug Something isn't working label Nov 11, 2022
@LinusBorg
Copy link
Member

This has been fixed in 3.2.45, but maybe not in the way you want it to. See:

#6248
f73925d

@github-actions github-actions bot locked and limited conversation to collaborators Sep 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants