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

uni-app 编译到抖音mp-toutiao平台组件开启virtualHost后event不会触发 #5006

Open
Moonofweisheng opened this issue Jun 25, 2024 · 3 comments

Comments

@Moonofweisheng
Copy link

hbuilderX版本:4.22.2024062415-alpha
复现demo:toutiao-vue3-virtualhost
问题描述:
当组件开启了virtualHost后,运行到mp-toutiao平台,无法触发定义的test事件。 组件代码:

<template>
	<view class="test" @click="handleClick">点我测试</view>
</template>
<script lang="ts">
export default {
  name: 'virtual-host-cmp',
  options: {
    addGlobalClass: true,
    virtualHost: true,
    styleIsolation: 'shared'
  }
}
</script>
<script lang="ts" setup>
	const emit = defineEmits(['test'])
	function handleClick() {
		emit('test')
	}
</script>

使用:

<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
		<virtual-host-cmp @test="handleTest"></virtual-host-cmp>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: 'Hello'
			}
		},
		onLoad() {

		},
		methods: {
				
			handleTest(){
				uni.showToast({
					title:'点到了'
				})
			}
		}
	}
</script>
@Moonofweisheng
Copy link
Author

补充:4.15~4.22均可以复现该问题。

@Moonofweisheng
Copy link
Author

相关issue:#4969 #4699

@YaWeiBoy
Copy link

编译到抖音平台真是一步一个坑

@Moonofweisheng Moonofweisheng changed the title uni-app 编译到mp-toutiao平台组件开启virtualHost后event不会触发 uni-app 编译到抖音mp-toutiao平台组件开启virtualHost后event不会触发 Jun 27, 2024
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

2 participants