标签:ret span component v-for state 循环 extend from his
17==》循环数组 类似v-for import React, { Component } from "react"; export default class CharShop extends Component { // state初始化一般写在构造器当中 constructor(props){ super(props); this.state={ goods: [ { id: 1, text: "web111" }, { id: 2, text: "web222" }, { id: 3, text: "web333" } ] } } render(){ return( <div> {/* 条年渲染 类v-for */} {this.state.goods.map(item=> return <li key={item.id}>{item.text}</li> )} </div> ) } }
标签:ret span component v-for state 循环 extend from his
原文地址:https://www.cnblogs.com/IwishIcould/p/11966816.html