美文网首页
weex踩坑记录(4)

weex踩坑记录(4)

作者: 自律财富自由 | 来源:发表于2020-03-11 16:18 被阅读0次

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
    }

相关文章

  • Weex入门踩坑记录

    Weex入门踩坑记录

  • weex踩坑记录(4)

    1、weex中默认的css样式不要写: 2、color属性都写全,不然爆出警告(这个可能跟项目的配置有关)colo...

  • weex踩坑记录

    weex版本1.5.3npm版本 6.4.1 请求 调用本地包,文件请求使用nat.js http://natjs...

  • Weex 踩坑记录

    1、运行 npm start ,报错如下:webpack-dev-server: command not foun...

  • weex踩坑记录(2)

    1、在使用storage客户端存储的时候, 变量不能使用局部变量的形式,也就是下面这种是获取不到的,或者获取到了,...

  • weex踩坑记录(1)

    1、组件会被转为p标签,对于字体的样式直接写在组件上,写在外层div无效。2、背景图片直接...

  • weex踩坑记录(3)

    1、loadmore事件不会在web端触发2、不支持百分比单位3、垂直水平居中: justify-content:...

  • weex踩坑记录(5)

    1、如果你想让你scroller容器内的元素平均分配空间, 那么 在scroller外层包裹一个div, 给这个d...

  • uniApp-study

    1. weex-image(nvue)踩坑 https://weex.apache.org/zh/docs/com...

  • weex 踩坑

    1. 用weex实现页面跳转? 1.1 使用vue-router position: fixed/sticky 的...

网友评论

      本文标题:weex踩坑记录(4)

      本文链接:https://www.haomeiwen.com/subject/xeqovctx.html