文件
OmniCard/mpuniapp/pages/CSS/style-isolation/comp-isolated.uvue

42 行
874 B
Plaintext

<template>
<view class="component-container">
<view class="global-box page-box com-box">
<text class="com-text">多样式,只显示组件自身样式(紫色)</text>
</view>
<view class="global-box">
<text class="com-text global-text">全局样式(预期默认字体大小16px)</text>
</view>
<view class="page-box">
<text class="com-text page-text">页面样式(预期默认字体大小16px)</text>
</view>
<view class="com-box">
<text class="com-text">组件样式</text>
</view>
</view>
</template>
<script setup lang="uts">
defineOptions({
styleIsolation: 'isolated'
})
</script>
<style>
.com-box {
background-color: #d9d1ff;
padding: 10px;
margin: 10px;
border-radius: 8px;
border: 2px solid #9e4ef7;
}
.com-text {
color: #9e4ef7;
font-size: 16px;
}
.component-container {
margin: 10px;
}
</style>