(1) Use ant Weapp The total, notify, etc. in the JS file that need to be introduced to the JS file have no effect
At first, I followed the rules of vant but it didn’t work.
import Notify from 'path/to/@vant/weapp/dist/notify/notify';
Also change the path in it to the path of node_modules
import Notify from '../node_modules/@vant/weapp/dist/notify/notify';
But it didn't work
Solution
import Notify from '../node_modules/@vant/weapp/dist/notify/notify';
Replace with
import Notify from '../miniprogram_npm/@vant/weapp/notify/notify';
(2) Style issues
You need a box that fills the page of the applet and adapts to the size of the rpx used at the beginning, but rpx cannot adapt to the size. Its essence is 1rpx = 0.5px and it cannot dynamically change the size.
Solution
Use vh vw in the
applet. Although px cannot be used, vh vw is not affected.
Renderings:
(3) If you use the rich text component to display the label image data returned in the background, setting the style in wxss will not adjust the image width
Solution
Although we should not change the style of the label image data,
can we change the style of the img tag in all strings to inline style
this.setData({
introduceList:data.data.content.replace(/\<img/gi, '<img style="max-width:100%;height:auto"')
})