1. Applet copy text problem:

Only the Text component can be copied, with a Selectable property set to true. But not on ios. The solution is to add another user-selet attribute of true. Use both to solve the problem!


  1. Small program newline use newline character has no effect

One CSS property is width-space:pre-wrap; Can!!!!!


  1. The canvas font spacing of the applet is set to ctx.canvas. Style on the emulator. Line height. But you don’t have that on your phone.

The current way to calculate line height is to write it word by word, with a different top for each line.


  1. Canvas line wrapping problem of small program. Canvas text function cannot be wrapped by default

The current method I use is to compare the width of each word on a single line to the desired width of the page, and if it is going to be larger, change the left and top values for the next word.


  1. DPR should be calculated well when using canvas, because there is no unit like RPX in canvas

A screen-friendly RPX can be calculated as follows: RPX = the width of the phone’s screen/canvas width or the width of the design draft; And then the units times RPX are the units of adaptation


  1. The applet page displays the canvas directly at its highest level. Setting z-index doesn’t work either

Use wx.canvastotempFilepath () to convert the canvas into an image!

  1. Small program ios conversion timestamp, for XXXX -xx months such as – to split will be converted to

So replace with -xx.replace (/-/g, ‘/’)

  1. Small program input box if the height of the input box to change according to the content of the input text.

Instead of using the input component, use textare and set its maxLength because a maximum height of around 200 May not be sufficient. Then set the width of the Textare.

  1. Textare has a property called auto-height that automatically increases the height by three lines, so you need to set your own padding, otherwise the input box is too small.

  2. The main point is that Textare has an event, and bindlinechange (taro’s is onLineChange) can return the number of lines and the height of the text depending on the input line.

  3. Taro’s small program from the TWO-DIMENSIONAL code to get from the index page onload will drop to get, if you get to jump, jump can return to the home page, then this jump operation should not be placed above, because onload will only be executed once. The following data will not be available!!

  4. Micro channel applet using custom expression implementation:

1. How to customize emoticons? [grimace] corresponding => 😜 thread: 1. Use a JSON table, which stores the corresponding description text (such as the above “grimace”), and some other corresponding configuration fields, the online picture path corresponding to facial expression, whether it is online, the page, etc. Based on business requirements.

2. Render to the page and click to convert to description. The first is to convert the data in JSON into the corresponding data structure. The expression displayed on the interface is to change the corresponding image path in the structure to the IMG SRC. And can again outer set an expression, define an attribute, value for the expression of the description of the text!2.1 Convert the click into expression text.



3. After the user finishes the input or the text returned from the background, the corresponding description text is converted into an expression picture.

3.1 Here, rich-text is needed because it needs to be converted into pictures. You cannot use V-HTML (even for vUe-based frameworks) because deletion only deletes data and generated tags such as IMG are not deleted.

3.2 Text conversion method:

2. Delete the emoticons entered

1. When deleting, determine whether to delete the home page or delete the middle position (that is, find the cursor position, delete if the current cursor position and the input number is different is the middle). Select * from (select * from (select * from (select * from (select * from (select * from (select * from (select * from (select * from (select * from (select * from (select * from (select * from (select * from (select * from (select * from)))))

Text copy problem.

****1. Since the rich-text tag is used, user-select and selectable can be copied only with the text tag in the applet. But rich-text does not, and only CSS user-select:text is set; IOS cannot copy.

So copy in a different way, setting the long press event. But trao’s rich-text can’t add longPress events directly, so I’m not sure if the native version will work. You can wrap a tag around it and set the longPress event to the tag.

  1. Question about small program code

Normal scanning small program into the official version, the mobile phone can not develop while debugging. Can save the small program code, with the development of the tool “through the two-dimensional code compilation” debugging!

  1. The soft keyboard overwrites the input box.

AdjustPosition (adjustPosition) and cursorSpacing (adjustPosition) can be used in the adjustPosition input box.

  1. If you have a multi-screen page and it’s fixed at the bottom, this can be problematic, such as scrolling when manipulating input fields. So you need to change your content container from View to Scroll view. Set the scroll-y value dynamically (such as whether to get focus). AdjustPosition is set to false. (Uncertain, depending on the project Settings)

  2. You need to manually set the default font size. Otherwise, the default font size varies on different devices. For example, if one TAB is switched, one TAB is set, and the other is not set, jitter may occur during device switchover.

13. Small program video setting cover method; If no cover image is provided, the default first pin can be set, but the official one is not provided. Initial-time = ‘0.01’ can be used. The principle is to load the video by default.

  1. Click tabbar to go back to the top.

In fact, the official also provides API.

  1. Applets subscribe to the message, the default is to be placed in front of the callback function after the operation, can not be placed after a request, otherwise it will not subscribe, and some things subscription must depend on, such as the request interface after the callback, there will be some problems. You can listen with the Vue Watch. After listening for the callback of an interface, call the method of subscribing to the message in the callback function of watch.

  2. When using the time library, you need to pay attention to whether the time is implemented in 24 hours or 12 hours to avoid problems.

  3. There are two ways to get into the applet by scanning one is to get into the applet by scanning. The other is to enter by scanning a different QR code. The way they get parameters is different.

The applets are retrieved from options.sence, although they are retrieved from onLoad(options){}. The normal QR code is in options.q. Using them is all required to decode uricomponent (option.q/sence)