


Here is a simple example to illustrate the WeChat appletInterfaceCall:
First look at the effect:
This is the true appearance of the mini program, and the experience is somewhat similar to the native APP.
JSONData configuration:
{ "navigationBarBackgroundColor": "#ffffff", "navigationBarTextStyle": "black", "navigationBarTitleText": "萌店商品详情", "backgroundColor": "#eeeeee", "backgroundTextStyle": "light"}
JS code:
wx.request({ url: 'http://m.vd.cn/api/tuan/TuanGuide_api', //仅为示例,并非真实的接口地址 data: { code:"oneyuan" }, method: "POST", header: { "Content-Type": "application/x-www-form-urlencoded" //post }, complete: function( res ) { that.setData( { oneyuandata: res.data.data }); if( res == null || res.data == null ) { reject(new Error('网络请求失败')) } }, success: function(res) { if(res.data.code ==0){ resolve(res) } } })
Here is a brief explanation of JS, WCSS and WXML code Not offered!
url:这个是要请求的接口地址 data:一个入参 method:请求方式,如果是POST请求必须按上面写,默认是get请求,不用处理。 complete:页面请求完成后的方法,通过that.setData将数据传递给WXML页面。 success:页面加载成功后的执行方法。
[Related recommendations]
1. How to add a custom menu through http request?
2. Red envelope interface development example code for small program
3. Simple example code for small program development
The above is the detailed content of Share example tutorials on mini program development and calling interfaces. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.

Dreamweaver Mac version
Visual web development tools

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

WebStorm Mac version
Useful JavaScript development tools

Zend Studio 13.0.1
Powerful PHP integrated development environment
