Use uniapp third week

 

Tools: HBuilderX

Framework: uniapp

After, plus hands-on learning fast three weeks, the understanding of uniapp another rise to a new level today, and recorded several common api method

1 / introduce a request method: uni.request ()   

Background ajax request call interface parameters used url (address) Data (request parameter) header (request header) Method (request mode) Success (callback request was successful)   

Additional links: https://uniapp.dcloud.io/api/request/request

 

2 / prompt message describes two components: uni.showToast / Modal ()

Message box Toast title (title) icon (icon, default √) position (message location) duration (time display)

Message confirmation box Modal title (title) content (content) cancelText (Cancel button Settings> Default cancel) success (success callback interface call)

 

3 / locally acquired data acquisition introduces two api: uni.getStorage (asynchronous) uni.getStorageSync (sync) 

uni.getStorage key (locally stored inside the key) success (for success callback)

uni.getStorageSync key (local key)

Specific usage: https://uniapp.dcloud.io/api/storage/storage?id=getstorageinfosync

 

4 / introduced two routing modes: uni.navigateTo uni.SwitchTab page jump

uni.navigateTo url (jump path may pass parameters such as: "../index/index?id=123456") page jump non tabbar

uni.SwitchTab (url) can only be used to jump the tabbar

 

5 / introduce two life cycle: onLoad onShow

onLoad page load monitor which obtains transmission parameters, such as previous page onLoad: function (option) {var id = option.id} printed 123456

onShow page display monitor display will trigger each time the page

Specific information: https://uniapp.dcloud.io/collocation/frame/lifetime

 

Learning is like rowing upstream! ! !

I just started learning uniapp little rookie, the veterans who educated us hope! Touch da

Guess you like

Origin www.cnblogs.com/poyfx/p/11242147.html