backface-visibility 属性在存在内嵌元素时显示错误

小游戏 企业微信 微信支付 小程序 文章 2020-07-30 21:20 691 0 全屏看文

AI助手支持GPT4.0

backface-visibility 属性在存在内嵌元素时显示错误
框架类型 问题类型 终端类型 微信版本 基础库版本
小程序 Bug 微信安卓客户端 7.0.17 2.9.0

卡牌正反面的需求。等效代码在 chrome 是没有问题的,但在小程序开发工具和安卓上有问题。(iOS 没测)

具体问题:如果卡牌正反面只是图片,正反显示都没问题。如果卡牌正反面是容器,里面有图片和文字。卡牌翻转过来,正反面的文字都显示了。预期只显示某一面的文字。

// wxml<view class="card-wrapper {{ status ? 'show-cover' : '' }}">  <view class="cover-image">    <image class="card-image" src="{{ coverImage }}" />    <text class="card-text">{{ text }}</text>  </view>  <view class="back-image">    <image class="card-image" src="{{ backImage }}"></image>    <text class="card-text">{{ text }}</text>  </view></view>// wxss.card-wrapper {  width100%;  height100%;  position: relative;  transform-style: preserve-3d;}.card-wrapper.show-cover {  transform: rotateY(180deg);}.cover-image,.back-image {  width100%;  height100%;  position: absolute;  left0;  top0;  backface-visibility: hidden;}.cover-image {  transform: rotateY(180deg);  transform-origin: center;}/* .back-image {  backface-visibility: hidden;} */.card-image {  width100%;  height100%;}.card-text {  display: block;  width100%;  line-height1;  margin-top: -120rpx;  text-align: center;  color: white;  font-size36rpx;  text-shadow:1px 2px 4px rgba(27,95,168,0.6);}.back-image .card-text {  opacity0.4;  margin-top: -128rpx;}


Framework type problem type terminal type wechat version basic library version applet bug wechat Android client 7.0.17 2.9.0 card front and back requirements. The equivalent code has no problem in chrome, but it has problems in applet development tools and Android. (IOS not tested) specific problem: if the front and back of the card are just pictures, the front and back display is OK. If the front and back of the card are containers, there are pictures and text inside. The card is turned over and the words on the front and back are displayed. Only one side of the text is expected to be displayed. / / wxml          {{ text }}            {{ text }}  // wxss.card -wrapper {  width: 100%;  height: 100%;  position: relative;  transform-style: preserve-3d;}.card- wrapper.show -cover {  transform: rotateY(180deg);}.cover-image,.back-image {  width: 100%;  height: 100%;  position: absolute;  left: 0;  top: 0;   backface-visibility: hidden;}.cover-image {  transform: rotateY(180deg);  transform-origin: center;}/* .back-image {  backface-visibility: hidden;} */.card-image {  width: 100%;  height: 100%;}.card-text {  display: block;  width: 100%;  line-height: 1;  margin-top: -120rpx;  text-align: center;   color: white;  font-size: 36rpx;  text- shadow:1px  2px 4px rgba(27,95,168,0.6);}.back-image .card-text {  opacity: 0.4;  margin-top: -128rpx;}

回答:

社区技术运营专员-CJiang:

麻烦提供能复现问题的简单代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)。

-EOF-

AI助手支持GPT4.0