通过storage实现参数的传递和接受
uni传递参数:
<template>
<view>
<web-view :src="url"></web-view>
</view>
</template>
<script>
export default {
data() {
return {
url: "/hybrid/html/ydbg/yw/yw_contment.html",
};
},
onLoad(option) {
uni.setStorageSync("title",option.title);
uni.setStorageSync("xxid",option.xxid);
uni.setStorageSync("lmmc",option.lmmc);
this.url += '?title='+ encodeURIComponent(option.title) +
'&xxid=' + encodeURIComponent(option.title) +
'&lmmc=' + encodeURIComponent(option.lmmc) +
'&ver='+Math.random();
}
}
</script>
html接受参数:
mui.plusReady(function() {
var title = plus.storage.getItem("title");
var xxid = plus.storage.getItem("xxid");
var lmmc = plus.storage.getItem("lmmc");
}