我在页面中使用了uni.getStorageSync方法,在web运行是正常的,但是运行在真机上时,会报方法找不到的错误。
是一个地图功能,script用了renderjs,引用了自定义的一个mapTool的js文件,js中有init方法,在init方法中使用了getStorageSync方法。
![Y***@sina.com](https://img-cdn-tc.dcloud.net.cn/account/identicon/0e74763c0d8587b3992958ce97786784.png)
- 发布:2024-12-23 16:58
- 更新:2024-12-24 15:19
- 阅读:107
![2***@qq.com](https://img-cdn-tc.dcloud.net.cn/account/identicon/1b0e013e98abe41f29eadb4dd79548ed.png)
我遇到了同样的问题 vue3 hbuilderx4.36
-
Y***@sina.com (作者)
好像是renderjs里面无法调用uni的方法。没别的办法的话,只能是在原生uni的script中调用uni方法,数据传给renderjs用
2024-12-24 15:39
2***@qq.com
我遇到了同样的问题 vue3 hbuilderx4.36
2024-12-24 15:17
Y***@sina.com (作者)
vue3,HBuilderX4.36。单页面源码如下
<template>
<view style="width: 100%;height: 100vh;">
<view class="mapview" id="mapView"></view>
</view>
</template>
<script>
export default {
data() {
return {
</script>
<script module="myMapViews" lang="renderjs">
// import mapTools from "../../../js_sdk/arcgis_map_tools/mapTools.js";
export default {
data() {
return {}
},
mounted() {
// 页面初始化完成后
this.showMap();
},
methods: {
showMap() {
// mapTools.init("mapView", () => {
// //加载完成后调用
</script>
<style>
.mapview {
width: 100%;
height: 100%;
position: absolute;
z-index: auto;
background-color: #eee;
}
</style>
2024-12-24 15:22