场景:在A页面引入一个B页面,两个页面都有modal框,针对于一个组件,把样式重写了,因此有了样式冲突
解决方案:给标签加上一个class或者一个id(注意外层这个setStyle)
<view class="setStyle">
<u-modal :show="modalFlag" showCancelButton="true" closeOnClickOverlay="true"
@close="closeModal" :showConfirmButton="false" :showCancelButton="false">
<view style="display: flex;flex-direction: column;">
<view class="titleDesc">复制链接,可前往电脑端管理商品库</view>
<view class="contentDesc">{{website}}</view>
<view style="margin-top: 38%;display: flex;justify-content: space-between;margin-left: 49rpx;">
<view class="knowButton" @click="closeModal()">
知道了
</view>
<view class="copyButton" @click="copyLink">
复制链接
</view>
</view>
</view>
</u-modal>
</view>
重写的样式加class:
.setStyle /deep/ .u-modal__content.data-v-0156a215 {
padding-top: 0 !important;
padding: 0 0 !important;
display: flex;
flex-direction: row;
justify-content: center;
width: 563rpx;
height: 424rpx;
background: #FFFFFF;
border-radius: 6rpx;
}
加上这个标识setStyle,指定样式,这样就ok了
遇见了这个小问题,仅此记录下