UNPKG

@tencentcloud/ai-desk-customer-wechat

Version:

AI Desk customer UIKit for wechat mini program

29 lines (28 loc) 898 B
"use strict"; const common_vendor = require("../../../../common/vendor.js"); const aiDeskCustomerUniapp_components_common_Toast_type = require("./type.js"); const Toast = (options) => { common_vendor.i.showToast({ title: options.message || "Toast", duration: options.duration || 1500, icon: handleIconType(options.type) }); }; const handleIconType = (type) => { if (!type) { return "none"; } switch (type) { case aiDeskCustomerUniapp_components_common_Toast_type.TOAST_TYPE.ERROR: return "none"; case aiDeskCustomerUniapp_components_common_Toast_type.TOAST_TYPE.WARNING: return "none"; case aiDeskCustomerUniapp_components_common_Toast_type.TOAST_TYPE.SUCCESS: return "success"; case aiDeskCustomerUniapp_components_common_Toast_type.TOAST_TYPE.NORMAL: return "none"; default: return "none"; } }; exports.Toast = Toast;