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

<script setup>的透传问题 #12540

Open
gyt95 opened this issue Sep 21, 2022 · 1 comment
Open

<script setup>的透传问题 #12540

gyt95 opened this issue Sep 21, 2022 · 1 comment
Labels
F-vue3 Framework - Vue 3 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@gyt95
Copy link

gyt95 commented Sep 21, 2022

相关平台

微信小程序

小程序基础库: 2.25.2
使用框架: Vue 3

复现步骤

// 父组件
<child text="xxx" @success="success">

// 子组件
<template>
 <grand-son>
</template>

<!-- Vue3.2 要求这个是单独一个script标签写的 -->
<script lang="ts"> 
export default { inheritAttrs: false } 
</script> 

<script lang="ts" setup> 
// ...
 </script>

// 孙组件
<template>
  <nut-xxx :title="text" @success="success"/>
</template>

<script lang="ts" setup>
const attrs = useAttrs(); 
const { text, success } = attrs; 
</script>

期望结果

孙组件调用父组件透传的事件后能正常触发父组件对应的事件

实际结果

无法触发父组件透传的事件

环境信息

👽 Taro v3.4.12


  Taro CLI 3.4.12 environment info:
    System:
      OS: Windows 10

补充信息

像以上这样写,属性text没问题,但事件success则无效,如何解决?是Taro版本还未支持还是我哪里写错了

@taro-bot2 taro-bot2 bot added F-vue3 Framework - Vue 3 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels Sep 21, 2022
@Chen-jj
Copy link
Contributor

Chen-jj commented Sep 21, 2022

@gyt95 麻烦提供一下完整 demo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-vue3 Framework - Vue 3 T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants