const query = wx.createSelectorQuery()
query.select('#the-id').boundingClientRect()
query.selectViewport().scrollOffset()
query.exec(function(res){
res[0].top // #the-id节点的上边界坐标
res[1].scrollTop // 显示区域的竖直滚动位置
})
Reference:https://developers.weixin.qq.com/miniprogram/dev/api/wx.createSelectorQuery.html
npm install npm-package --production
require
const package = require('packageName')
const packageOther = require('packageName/other')
or import WeCropper from '../../miniprogram_npm/we-cropper/index.js'
Reference:https://developers.weixin.qq.com/miniprogram/dev/devtools/npm.html