html
render() {
return (
<div className='Addcart'>
<div className='box'>
{this.state.arr.map((item, index) => <div className='div' key={index}>{item} <span onTouchStart={this.Fnstart.bind(this)}>+</span></div>)}
<div className='collect' ref={this.collect}> <span>数量</span> : {this.state.num}</div>
</div>
</div>
)
}
js
import React, { Component, createElement, createRef } from 'react'
import './index.less'
interface iProps { }
interface iState { arr: string[], num: number }
export default class Addcart extends Component<iProps, iState> {
constructor(props: iProps) {
super(props)
this.sta