Detailed explanation of the solution that fails the small program review, detailed explanation of the small program
Preface
Recently, applets have been active in developers' eyes. Many developers are involved in the development of small programs, and these developers always need to face the last challenge: how to pass the official review in an elegant manner. This article is based on a summary submitted for review a few days ago. please correct me if you have written anything inappropriate.
Problem description
First, let's take a look at the description file of common denial situations on the applet platform. Because the submitted applet contains the "share group" button, the review fails. The reason for the failure is as follows:
3.2.1 There are induced behaviors in the page content of the applet, including but not limited to inducing sharing, inducing addition, attracting public accounts, and downloading, A program that requires users to share, add, follow, or download data. It contains text, images, buttons, floating layers, pop-up windows, and other small programs that explicitly or implicitly share data with users, small programs that induce users to share and spread through the temptation of interests will be rejected if users are forced to add or induce users to share through exaggerated words;
Isn't the hard-to-develop mini-programs getting lost? I can't bear it!
Solution
I have heard a sentence: "Since I cannot touch you, I chose to let myself go ." So, since we cannot change the constraints of official regulations, we should avoid conflicts with them. The solution is roughly as follows:
Step 1: Add a judgment mechanism to the entry file of the applet to control the version of the applet.
Step 2: compile a simple version to be submitted for review.
Step 3: Wait for the review to pass, and then switch back to the official version through the judgment mechanism set in step 1.
Next, let's talk about how it works.
1. First, I created a QuickStart project, such:
2. Add a judgment mechanism to the entry file index. wxml to control the version of the applet. The Code is as follows:
<! -- Index. wxml --> <view class = "" wx: if = "{version = '0'}" wx: key> <! -- This is the second entry to the applet, where simple code that can pass the review normally --> <text> hello </text> </view> <view class = "" wx: else> <! -- This is the first entry to the applet, where the code after the official launch is put, that is, the code that cannot pass the review after submission --> <view class = "container"> <view class = "userinfo"> <button wx: if = "{{! HasUserInfo & canIUse} "open-type =" getUserInfo "bindgetuserinfo =" getUserInfo "> get Avatar nickname </button> <block wx: else> <image bindtap = "bindViewTap" class = "userinfo-avatar" src = "{userInfo. avatarUrl }}" background-size = "cover"> </image> <text class = "userinfo-nickname" >{{ userInfo. nickName }}</text> </block> </view> <view class = "usermotto"> <text class = "user-moname" >{{ motto }} </ text> </view>
Next, set the version value in index. js. The specific code is as follows:
data: { motto: 'Hello World', userInfo: {}, hasUserInfo: false, canIUse: wx.canIUse('button.open-type.getUserInfo'), version: 0 }
The running result is as follows:
3. Now, the second step is to compile a simple version to be submitted for review. However, this is only used for testing. The version to be submitted for review cannot be too simple. I suggest you include a simple version you have previously used.
4. Control version switching. The Code shows that version switching depends on the version value. Therefore, you can add a version field to the interface for version submission and approval to dynamically switch versions. You can switch back to the official version if the version field is not 0.
Conclusion
Although this method can be used to avoid review, it is recommended that the developed mini-programs be healthy and create a Green mini-program environment together. Everyone is responsible.
The above is all the content of this article. I hope it will be helpful for your learning and support for helping customers.