<template>
<view class="content">
<image class="logo" src="/static/logo.png"></image>
<view class="text-area">
<text class="title">{{title}}</text>
<button @click="onClick">click me</button>
</view>
</view>
</template>
<script lang="jsx">
export default {
data() {
return {
title: 'Hello'
}
},
onLoad() {
},
methods: {
onClick(){
const dbJQL = uniCloud.databaseForJQL()
console.log('ok')
}
}
}
</script>
<style>
.content {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.logo {
height: 200rpx;
width: 200rpx;
margin-top: 200rpx;
margin-left: auto;
margin-right: auto;
margin-bottom: 50rpx;
}
.text-area {
display: flex;
justify-content: center;
}
.title {
font-size: 36rpx;
color: #8f8f94;
}
</style>

- 发布:2023-08-02 16:05
- 更新:2023-08-02 17:24
- 阅读:234
产品分类: uniapp/H5
PC开发环境操作系统: Windows
PC开发环境操作系统版本号: windows11
HBuilderX类型: Alpha
HBuilderX版本号: 3.8.11
浏览器平台: Edge
浏览器版本: 版本 115.0.1901.183 (正式版本) (64 位)
项目创建方式: HBuilderX
示例代码:
操作步骤:
发布后点 click me 按钮,看控制台。
发布后点 click me 按钮,看控制台。
预期结果:
正常看到 打印 ”ok“
正常看到 打印 ”ok“
实际结果:
报错:ReferenceError: uniCloud is not defined
报错:ReferenceError: uniCloud is not defined
bug描述:
使用jsx的组件 发布后 无法使用const dbJQL = uniCloud.databaseForJQL()
会报错:ReferenceError: uniCloud is not defined
在dev时不报错,我认为dev不报错的原因是此时 uniCloud 对象会挂载到window里