Home > WeChat Applet > WeChat Development > Make a mobile WeChat public account (with code)

Make a mobile WeChat public account (with code)

php中世界最好的语言
Release: 2018-06-04 15:41:11
Original
3615 people have browsed it

This time I will bring you how to make a mobile WeChat public account (with code) and what are the precautions for making a mobile WeChat public account. The following is a practical case, let’s take a look.

The first pitfall: WeChat sharing causes the Android phone to be unable to open the photo album and cannot activate WeChat recharge

Solution:

setTimeout(_ => {
      wx.config(sdkConfig)
     }, 500)
Copy after login

WeChat sharing needs to be delayed by 500 milliseconds. This solves the problem of Android phones being unable to call photo albums and WeChat recharge. If WeChat sharing is used, a delay needs to be added.

Second Pitfall: Some third-party input methods on mobile phones will squeeze the page online

Solution:

// 特定需求页面,比如评论页面,输入框在顶部之类的
const interval = setInterval(function() {
  document.body.scrollTop = 0;
}, 100)
// 注意关闭页面或者销毁组件的时候记得清空定时器
clearInterval(interval);
Copy after login

The third pit: Mobile 4Gpost submission in some areas does not respond

My vue project is interface encapsulated by axios. In the project, there are always requests from some areas but no response. I will check later. Finally, the backend only received the options request. The key is that this situation only occurs for individual users. I will read the article laterhttps://itbilu.com/javascript/js/VkiXuUcC .html introduces these requests, let’s go straight to the code without further explanation

Solution:

import axios from 'axios'
import qs from 'qs'
service.interceptors.request.use(
 config => {
 if(config.method === 'post'){
  config.data = qs.stringify(config.data)
 }
 return config
},
 error => {
  console.log(error)
  Promise.reject(error)
 }
)
Copy after login

The project has been in progress for several months. I really don’t have time to post it, so I will continue to post the pitfalls I actually encountered in the future. . .

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How to make the effect of switching fonts by clicking on the title text

How to solve the error in configuring the packaging file path

The above is the detailed content of Make a mobile WeChat public account (with code). For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template