How to use the @tarojs/taro-h5.navigateBack function in @tarojs/taro-h5

To help you get started, we’ve selected a few @tarojs/taro-h5 examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github NervJS / taro / packages / taro-components / src / components / navigator / index.js View on Github external
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
        })
        break
      case 'exit':
        promise = Promise.reject({
          errMsg: `navigator:fail 暂不支持"openType: exit"`
        })
        break
    }
    if (promise) {
      promise.then(res => {
        onSuccess && onSuccess(res)
        onComplete && onComplete(res)
      }).catch(res => {
        onFail && onFail(res)
        onComplete && onComplete(res)