taro循环一个渐变的View
Posted 山石
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了taro循环一个渐变的View相关的知识,希望对你有一定的参考价值。
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的主要内容,如果未能解决你的问题,请参考以下文章