Home > Web Front-end > JS Tutorial > How to use vue to create a mobile WeChat public account

How to use vue to create a mobile WeChat public account

php中世界最好的语言
Release: 2018-06-02 10:07:12
Original
2522 people have browsed it

This time I will show you how to use vue to make a mobile WeChat official account, and what are the precautions for using vue to make a mobile WeChat official 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 later

https://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:

Node.js console output log file example analysis

How to use Vue to achieve drag and drop effects

The above is the detailed content of How to use vue to create a mobile WeChat public account. 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