>  기사  >  위챗 애플릿  >  WeChat Mini 프로그램: 대화형 피드백 API 설명

WeChat Mini 프로그램: 대화형 피드백 API 설명

高洛峰
高洛峰원래의
2017-03-03 10:41:282482검색

wx.showToast(OBJECT)

메시지 프롬프트 상자 표시
OBJECT 매개변수 설명:
[tr] 매개변수 유형 필수 설명[/tr]

title String 提示的内容
icon String 图标,只支持"success"、"loading"
duration Number 提示的延迟时间,单位毫秒,默认:1500, 最大为10000
success Function 接口调用成功的回调函数
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

샘플 코드:

wx.showToast({
    title: '成功'icon: 'success',
    duration: 2000
}) wx.hideToast()


메시지 프롬프트 상자 숨기기

아아아앙




모달 팝업 표시
OBJECT 매개변수 설명:
[tr]매개변수 유형에 대한 필수 설명[/tr]

title String 提示的标题
content String 提示的内容
showCancel Boolean 是否显示取消按钮,默认为 true
cancelText String 取消按钮的文字,默认为"取消"
cancelColor HexColor 取消按钮的文字颜色,默认为"#000000"
confirmText String 确定按钮的文字,默认为"确定"
confirmColor HexColor 确定按钮的文字颜色,默认为"#3CC51F"
success Function 接口调用成功的回调函数,返回res.confirm==1时,表示用户点击确定按钮
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

샘플 코드:

wx.showToast({
    title: '加载中',
    icon: 'loading',
    duration: 10000
}) setTimeout(function() {
    wx.hideToast()
},
2000) wx.showModal(OBJECT)



작업 메뉴 표시
OBJECT 매개변수 설명:
[tr]매개변수 유형 필수 설명[/tr]

itemList String Array 按钮的文字数组,数组长度最大为6个
itemColor HexColor 按钮的文字颜色,默认为"#000000"
success Function 接口调用成功的回调函数,详见返回参数说明
fail Function 接口调用失败的回调函数
complete Function 接口调用结束的回调函数(调用成功、失败都会执行)

성공 반환 매개변수 설명:
[tr]매개변수 유형 설명[/tr]

cancel Boolean 用户是否取消选择
tapIndex Number 用户点击的按钮,从上到下的顺序,从0开始

샘플 코드:

wx.showModal({
    title: '提示',
    content: '这是一个模态弹窗',
    success: function(res) {
        if (res.confirm) {
            console.log('用户点击确定')
        }
    }
}) wx.showActionSheet(OBJECT)


더 많은 WeChat 미니 프로그램: 대화형 피드백 API 지침, 관련 기사를 보려면 PHP 중국어 웹사이트에 주목하세요!

성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.