百度智能小程序 設(shè)置窗口下拉背景l(fā)oading樣式

2020-09-05 14:11 更新

swan.setBackgroundTextStyle

基礎(chǔ)庫(kù) 3.10.4 版本開(kāi)始支持。

解釋?zhuān)涸O(shè)置窗口下拉背景 loading 樣式。

方法參數(shù)

Object object

object參數(shù)說(shuō)明

屬性名類(lèi)型必填默認(rèn)值說(shuō)明

textStyle

String

loading 圖樣式,有效值 light 和 dark 。11.3
低版本請(qǐng)做兼容性處理

success

Function

接口調(diào)用成功的回調(diào)函數(shù)

fail

Function

接口調(diào)用失敗的回調(diào)函數(shù)

complete

Function

接口調(diào)用結(jié)束的回調(diào)函數(shù)(調(diào)用成功、失敗都會(huì)執(zhí)行)

示例 

在開(kāi)發(fā)者工具中打開(kāi)



圖片示例



代碼示例

<view class="wrap">
    <button bind:tap="setBackgroundTextStyle" hover-stop-propagation="true" type="primary">點(diǎn)擊切換loading樣式為:{{textStyle}}</button>
</view>
Page({
    data: {
        textStyle: 'dark'
    },
    onShow() {
        this.setBackgroundTextStyle();
        swan.startPullDownRefresh();
    },
    setBackgroundTextStyle() {
        let textStyle = this.data.textStyle;
        swan.setBackgroundTextStyle({
            textStyle: textStyle,
            success: () => {
                console.log('setBackgroundTextStyle success');
                textStyle === 'dark' 
                ?this.setData('textStyle', 'light')
                :this.setData('textStyle', 'dark');
            },
            fail: err => {
                console.log('setBackgroundTextStyle fail', err);
            }
        });
    }
});
{
    "navigationBarTitleText": "setBackgroundTextStyle",
    "enablePullDownRefresh": true
}


錯(cuò)誤碼

Android

錯(cuò)誤碼說(shuō)明

202

解析失敗,請(qǐng)檢查參數(shù)是否正確

1001

執(zhí)行失敗

iOS

錯(cuò)誤碼說(shuō)明

202

解析失敗,請(qǐng)檢查參數(shù)是否正確


以上內(nèi)容是否對(duì)您有幫助:
在線(xiàn)筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)