// test.vue
<template>
<view>
你好
</view>
</template>
<style>
view {
background-color: red;
}
<style>
产品分类: HbuilderX
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: windows 10 E
HBuilderX版本号: 3.7.0
// test.vue
<template>
<view>
你好
</view>
</template>
<style>
view {
background-color: red;
}
<style>
1、把子组件使用import引入后 import test from '@/component/test/test.vue';
export default {
components: {
test
},
}
2、在 template 中直接使用 <test></test>
1、文字应该有红色背景
1、文字应该有没有出现背景颜色,CSS不生效,还是没有编译进去?微信开发者工具中查看WXML中查看元素没有background-color
HBuilder X 3.7.0 版本
在微信小程序中,自己写的子组件 。在page中引用后, 子组件中定义的CSS样式无效。
换回 HBuilder X 3.6.18 版本 正常。
p***@126.com (作者)
是的,alpha版
2023-02-08 19:29