import React,{Component} from 'react'; import {Button, View,OpenData} from '@tarojs/components' import Taro from '@tarojs/taro'; import { AtIcon } from 'taro-ui' import 'taro-ui/dist/style/components/icon.scss'; import './index.less'; class UserFloatingLayer extends Component{ constructor(props) { super(props); this.state={ userInfor:{} } } componentDidMount() { let userInfor = Taro.getStorageSync('userInfor'); this.setState({ userInfor }) } render() { return( {this.state.userInfor.name} { Taro.setStorageSync("token", ""); Taro.setStorageSync('userInfor', ""); Taro.closeSocket(); Taro.reLaunch({ url: '/pages/login/index' }) }}>退出 ); } } export default UserFloatingLayer;