How to use the @tarojs/taro.showToast function in @tarojs/taro

To help you get started, we’ve selected a few @tarojs/taro 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 SolidZORO / leaa / packages / leaa-miniprogram / src / pages / account / _components / LoginButton / LoginButton.tsx View on Github external
try {
      sessionResponse = await Taro.request({
        method: 'POST',
        url: `${envConfig.WECHAT_HOST}/oauth/wechat/session`,
        data: loginResponse,
      });

      if (sessionResponse && sessionResponse.data) {
        Taro.setStorageSync('openId', sessionResponse.data.openid);
        Taro.setStorageSync('sessionKey', sessionResponse.data.session_key);
      }
    } catch (e) {
      console.log(e);
      setLoginLoading(false);
      await Taro.showToast({ title: '获取 Key 失败' });

      return;
    }

    console.log('sessionResponse', sessionResponse);

    //
    // ------------------------------------
    let userInfoResponse: {
      encryptedData: string;
      iv: string;
      rawData: string; // JSON string
      signature: string;
      userInfo: {
        avatarUrl: string;
        city: string;
github NervJS / taro-ui / src / pages / navigation / navbar / index.js View on Github external
clickReturn () {
    Taro.showToast({
      'title': '返回',
      'duration': 2000,
      'icon': 'success'
    })
  }
  clickMy () {
github wsdo / taro-kit / src / utils / cutter.js View on Github external
success(res) {
        Taro.showToast({
          title: '图片已经保存到相册',
          icon: 'none',
          duration: 1500,
          mask: false,
        });
      },
      fail: function (res) {
github BinZhiZhu / Taro-v2ex-weapp / src / pages / member / index.tsx View on Github external
}).catch((error) => {
      showToast(error.message)
    });
  }
github NervJS / taro-ui / src / pages / navigation / navbar / index.js View on Github external
handleClick (title) {
    Taro.showToast({
      'title': title,
      'duration': 2000,
      'icon': 'success'
    })
  }
  clickReturn () {
github imageslr / taro-library / src / service / interceptors.js View on Github external
function showError(message, show = true) {
  show &&
    Taro.showToast({
      title: message || "请求异常",
      icon: "none"
    });
  return Promise.reject(message);
}
github lsqy / taro-music / src / pages / songDetail / index.tsx View on Github external
changePlayMode() {
    let { playMode } = this.props.song
    if (playMode === 'loop') {
      playMode = 'one'
      Taro.showToast({
        title: '单曲循环',
        icon: 'none',
        duration: 2000
      })
    } else if (playMode === 'one') {
      playMode = 'shuffle'
      Taro.showToast({
        title: '随机播放',
        icon: 'none',
        duration: 2000
      })
    } else {
      playMode = 'loop'
      Taro.showToast({
        title: '列表循环',
        icon: 'none',
        duration: 2000
      })
    }
    this.props.changePlayMode({
      playMode
    })
  }