Alipay creates personal identity
[if you want to become a small program administrator of the company's project, do not become = = self-developed developer = =] It can't be set
The cache mechanism of Alipay
setStorageSync [Set local storage] my.setStorageSync({ key: 'park_id', data: { park_id: 1, } });
========================================================
[Suggested that getStorageSync Encapsulation, because of Alipay. getStorageSync,Very different] const getStorageSync = (key) => { return my.getStorageSync({ key: key }).data || null } getStorageSync('park').park [Get local storage]
③ custom components
Do not set long name for custom components { "defaultTitle": "my", "usingComponents": { "c-yuhistory": "/component/c-yuhistory/c-yuhistory", "chs": "/component/c-parkingHistory/c-parkingHistory" } } A name as long as c-parkingHistory cannot be used to activate a custom component. You need to change it to a shorter name like 'chs'.
④ file name
xx.axml xx.acss xx.json xx.js
⑤app.json
`"window": { "defaultTitle": "Alipay", //Page title "titleBarColor": "#d05021 ", / / navigation bar background color "pullRefresh":true, //Allow drop-down refresh default false "allowsBounceVertical": yes, //Whether the page supports vertical pull beyond the actual content. Default YES },` "tabBar": { "textColor":"#000 ", / / no font color selected "selectedColor":"#d81e06 ", / / selected font color "backgroundColor":"#fff ", / / background color "items": [{ "pagePath": "pages/index/index" , //Page path "name": "home page", //Page title "icon": "pages/icon/index.png", //Select icon for "activeIcon": "pages/icon/index_1.png" //Select Icon }
⑥ difference of events
on event binding does not prevent bubbling events from bubbling up, The catch event binding prevents the bubbling event from bubbling up.
⑦ http request [data request]
Alipay http The request is my.httpRequest({}) //If you need to set up header, Alipay is headers WeChat is header, the parameters are different. //If it is a post request, you need to add JSON.stringify to the value of data //Ultimately for my.httpRequest({ url: options.url, data: (options.method == 'POST' ? JSON.stringify(options.data) : options.data), method: options.method, headers: { Authorization: `wxatoken ${getStorageSync('tokenAndId').Token}`, "content-type": "application/json" }, success(res) { }, fail(err) { } });