Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onClick = () => {
const { openType, onSuccess, onFail, onComplete } = this.props
let promise
switch (openType) {
case 'navigate':
promise = Taro.navigateTo({
url: this.props.url
})
break
case 'redirect':
promise = Taro.redirectTo({
url: this.props.url
})
break
case 'switchTab':
promise = Taro.switchTab({
url: this.props.url
})
break
case 'reLaunch':
promise = Taro.reLaunch({
url: this.props.url
})
break
case 'navigateBack':
promise = Taro.navigateBack({
delta: this.props.delta
switchTab = (index) => {
this.setState({
selectedIndex: index
})
Taro.redirectTo && Taro.redirectTo({
url: this.state.list[index].pagePath
})
}