1.在全局引用
import {
getQuery,
toParams
} from '@/libs/utils'
Vue.prototype.query = getQuery
Vue.prototype.params = toParams
2.通过地址传参,首先构造要传的内容
goTest (item) {
const query = {
describe: item.describe,
id: item.id
}
wx.navigateTo({
url: `/pages/test?${this.params(query)}`
})
},
3.在获得页面接收数据,即可把一些特殊的符号都能显示啦
onLoad(options) {
var that = this
let { describe } = this.query()
describe = decodeURIComponent(describe)
this.title = describe
this.id = options.id
}