virtualHost 虚拟节点 会导致 tailwindcss 的class未生效, 名称里也没有小程序的下划下, 见截图
gaokun opened this issue · comments
附录 dist
里的 wxml
:
<image mode="{{a}}" src="{{b}}" style="{{c + ';' + virtualHostStyle}}" bindload="{{d}}" class="{{[virtualHostClass]}}"/>
感觉结果 wxml 和图上的 vue 组件对不上啊,我没有复现这个问题,有完整的 vue
组件代码提供嘛?
n-image
<template>
<image :mode="mode ?? 'widthFix'" :src="src" :style="styles" @load="onLoad" />
</template>
<script setup lang="ts">
import { computed, reactive } from 'vue';
const props = defineProps<{
mode?: string;
src: string;
style?: object;
}>();
const rect = reactive({
width: 0,
height: 0,
});
const styles = computed(() => ({
width: rect.width + 'rpx',
height: rect.height + 'rpx',
...props.style,
}));
function onLoad(event) {
const { detail } = event;
rect.width = detail.width;
rect.height = detail.height;
}
</script>
<script lang="ts">
import BaseComp from '../base/BaseComp';
export default {
name: 'NImage',
mixins: [BaseComp],
};
</script>
BaseComp
export default {
options: {
// multipleSlot: true,
// styleIsolation: 'isolated',
// addCglobalClass: true,
virtualHost: true,
},
};
看上去是 virtualHost 配置项导致的,我在复现的时候,发现我传入 class prop ,在最终的 wxml 调试器上全部丢失了
怀疑是 virtualHost 的问题
已经使用了最新了 uni vite 3 和 微信开发者工具。
add support in 2.8.3