码迷,mamicode.com
首页 > 其他好文 > 详细

taro循环一个渐变的View

时间:2020-11-07 15:33:04      阅读:23      评论:0      收藏:0      [点我收藏+]

标签:技术   ret   bsp   efault   this   load   pre   lis   style   

import React, { Component } from "react";
import { View, Text } from "@tarojs/components";
export default class Index extends Component {
  constructor(props) {
    super(props);
    this.state = {
      list: [1, 2, 3, 4, 5, 6],
    };
  }
  render() {
    return (
      <View>
        <View>
          {this.state.list.map((a, i) => {
            return (
              <View
                key={i}
                style={{ backgroundColor: `rgba(0,0,0,0.${a})` }}
            >{a}</View>
            );
          })}
        </View>
      </View>
    );
  }
}

效果:

技术图片

 

taro循环一个渐变的View

标签:技术   ret   bsp   efault   this   load   pre   lis   style   

原文地址:https://www.cnblogs.com/luguankun/p/13934736.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!