1.业务背景 有时候,小程序码是需要后端对某个路径进行编译生成的,然后,用户扫码后直接跳转到该路径。但是,前端如何拿到跳转路径后的参数呢? 2.拿参数 是在小程序页面的onload方法里面通过options参数获取的,并且需要用decodeURIComponent(options.scene)解析参数的。具体如下: Page({ onLoad (options) { // 需要使用 decodeURIComponent 才能获取到生成二维码时传入的 scene const scene = decodeURIComponent(options.scene) } })