mpvue achieve small micro-channel program (welcome step on pit)

Use mpvue recently completed the development of small micro-channel program, write something, to be a record.
First, it is still two Portal:
微信小程序文档:[https://developers.weixin.qq.com/miniprogram/dev/framework/MINA.html][1]
mpvue的官网链接:[http://mpvue.com/][2]
Stepped pit record:
  • On-device debugging when the local picture applet does not display;
    such as: Page path is: /pages/index/index.vue, image path: /static/img/1.png; index.vue first inside page image src as "../../../static/img/1.png; then displayed in the debug environment can be found a small program, but does not appear on the real machine; (but on the inside components written in this way pictures do not have this problem)

    解决方式:把pages引用的图片地址都改为'/static/',以根目录开头
  • Set the color before the time, liked rgba (0,0,0, .1), so that, when the real test then, my phone is Huawei mate9 (ios tested there is no problem, Andrews may be a problem) input when is blank but with mass, a point Enter to show, you can not lose the side edge display; debug a long time, I finally found the font color to rgba time will result in an error

    解决方式:把color的rgba设置改为#设置
  • Use picker component micro-channel applets realize Province - City choice; had wanted to directly picker city mode, but this data to the background and did not return to the area; there is more than one column picker selector, feeling incoming data it is troublesome; Finally picker-view; refreshing cool; it set two, respectively the incoming column array like; a pit encountered here is that the change in function to bind, I can not get to the current change which column of data; for the judgment to be done here, if the first column, then, to replace the contents of the array of the second column;

    解决方式:新建变量,在change函数中赋值,在watch里面监听;
  • Whether or onshow with onload method, the value of data inside the applet has not been initialized; for example, I would set up a state variable, the initial value is false, I become true when the page operation; back-off and then on, it is still is the true value; the problem I do not know where not taken into account, but with a temporary way to a solution is not the answer

    解决办法:在onload方法内重置状态变量
  • When the bottom of the navigation switch, onshow call every time, but onload only called once;
  • For image for, height: auto This property is not in effect; picture adaptive problems So now; because it is a rich text string, so there is no way as an official document setting mode; finally upgraded conversion plug-in I use ( mpvue-wxparse) version; it supports picture in rich text mode attributes.
  • Enter search is used before @ keyup.native small program which should be replaced @confirm
  • There the chain jump, there is a small program component <web-view: url = ""> </ web-view>, when implemented, as long as the chain alone do a page contains only above the label, incoming url on it. This tag is executed immediately, have this, I would jump in the current page directly, so I write it as a separate page. Specifically for the chain jumps; but outside the chain jumps or pit, jump in micro-channel can only support it had registered over there https URL, other or not, there is no way to find good; know almost looked, it's turned into text directly outside the chain can not be clicked.
Last words

Well, I write to temporarily do them justice, for the first time to write small programs, though with a lot less learning costs mpvue, but when transformed or met with a lot of problems, have been in the process of online search solutions ah, also send questions to ask you; feel the harvest is so large; wepy also heard very good use, the next development of small procedures, they can try to see with.

Guess you like

Origin www.cnblogs.com/jlfw/p/11870868.html