weex踩坑记录(4)

1、weex中默认的css样式不要写:

display,
position: relative,

2、color属性都写全,不然爆出警告(这个可能跟项目的配置有关)
color: #fff; -> color: #ffffff;

3、align-self: center;的替换方案:
1、在元素的外层加一个div标签,然后对该div设置居中flex布局: justify-content: center; align-items: center
2、如果该元素有固定的宽度: margin-left: (750 - 元素的宽度) / 2

4、自定义slider的指引器

<slider class="banner-slider" auto-play="true" interval="3000" @change="getSliderIndex">
      <div v-for="(banner, index) in data.bannerList" :key="index" >
        <image class="banner-slider-image" @load="onImageLoad" :resize="data.effect === 2 ? 'cover' : 'contain'" :src="banner.src"></image>
        <text class="banner-slider-title">{{banner.title}}</text>
      </div>
      <!-- <indicator class="banner-slider-indicator" v-if="data.effect === 2 && data.bannerList.length > 1"></indicator> -->
    </slider>
    <!-- 自定义indicator -->
    <div class="custom-indicator-box">
      <div class="custom-indicator" :class="[index === currentSliderIndex ? 'custom-indicator-active': '']" v-for="(banner, index) in data.bannerList" :key="index"></div>
    </div>
.banner-slider-indicator {
  position: absolute;
  right: 10px;
  bottom: 0;
  height: 60px;
  item-size: 20px;
  item-color: #dddddd;
  item-selected-color: #ffffff;
}
.custom-indicator-box {
  position: absolute;
  right: 10px;
  bottom: 0;
  height: 60px;
  flex-direction: row;
}
.custom-indicator {
  width: 20px;
  height: 20px;
  border-radius: 10px;
  border-width: 1px;
  border-style: solid;
  border-color: #ffffff;
  background-color: transparent;
  margin-right: 5px;
}
.custom-indicator-active {
  background-color: #ffffff;
}
.banner-slider-title {
  width: 750px;
  position: absolute;
  left: 0;
  bottom: 0;
  padding: 0 80px;
  font-size: 20px;
  line-height: 32px;
  text-align: center;
  color: #ffffff;
  background-color: rgba(102, 102, 102, 0.8);
  overflow: hidden;
  text-overflow: ellipsis;
  lines: 1;
}
    onImageLoad (event) {
     ...
    },
    getSliderIndex (e) {
      this.currentSliderIndex = e.index
    }
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 移动开发基本知识点 一.使用rem作为单位 html { font-size: 100px; } @media(m...
    横冲直撞666阅读 8,916评论 0 6
  • weex vue ios 原生 app 会不定时更新 img标签应为 ,路径不能引用本地静态文件 Android...
    warryy阅读 11,051评论 2 2
  • 关于css常见问题,大多是移动端的。 简单的排版规则:条目与条目之间空两行,每条内容部分分段空一行。标点符号全部用...
    苏水儿阅读 10,491评论 0 9
  • 第一章 复杂选择器 一、兄弟选择器:具备相同父元素的元素 ① 特点:1、通过位置关系来匹配元素(平级关系) ...
    fastwe阅读 4,183评论 0 0
  • flex 布局是 css3 中使用最频繁也是最出色的功能,有点复杂,分为应用在容器上的属性和项目上的属性,即父元素...
    rayman_v阅读 4,369评论 1 4

友情链接更多精彩内容