Summary of problems encountered in WeChat applet development

小云云
Release: 2018-01-25 15:08:03
Original
3943 people have browsed it

The development of the WeChat mini program has been completed, and naturally we have encountered many problems. In this article, we mainly share with you a summary of the problems encountered in the development of the WeChat mini program, hoping to help more WeChat developers.

Introduction to the mini program

"Let your interests no longer be lonely, let your hobbies no longer wander" is the theme of the WeChat mini program "Let's Go Together". This mini program aims to solve The loneliness of contemporary college students in campus life allows everyone to find like-minded friends and partners in activities such as running, fitness, and competitions. By combining the instant-use and easy-to-use features of the mini program with making friends, it will be an efficient, fast, and burden-free offline dating tool

This mini program is provided by bmob back-end cloud Data processing and storage support

Small program code

Summary of problems encountered in WeChat applet development

Summary of technical issues in development

1. The emergence of using e.target.dataset Question

In the process of developing small programs, we often use the attribute values of attributes in tags. We usually set data-*="{{XXX}}" in and then in JS I use e.target.dateset.* to get the XXX value, but I often encounter undefined. Use console.log(e) to check the output information and you will find that the e object contains two objects, namely currentTarget and target. , and sometimes the data is in currentTarget,

At this time, you can replace the code with this to get the value

WXML

Copy after login

JS

bintap:function(e){ var id = e.currentTarget.dataset.id; }
Copy after login

Online There is also a saying that the naming problem of * in data-* can be solved by removing the camel case naming and using pure lower case

2. How to display the real-time word count in the textarea text box of the applet

WXML