


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

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

Atom editor mac version download
The most popular open source editor

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software