|
至高吾·尚 · 2024-4-28 13:36你有一个事件执行失败了,查看一下你哪个函数方法内,去读了某个对象的hidden属性。
这个对象因为你逻辑的问题,在运行时环境内是null空值,导致这个对象是个null,而引起的报错。
...
我这个页面没有其他方法- <template>
- <view class="page">
- <sticky class="top">
- <text class="top-title">我的</text>
- </sticky>
- <view class="main">
- <button @click="scan">扫一扫</button>
- </view>
- </view>
- </template>
- <script>
- export default {
- name: 'my',
- apiready(){//like created
- //是否沉浸式显示页面(false的话会显示手机状态栏)
- api.setFullScreen({
- fullScreen: false,
- })
- //设置状态栏颜色(深色、浅色)
- api.setStatusBarStyle({
- style: 'light'
- });
- },
- data() {
- return{
-
- }
- },
- methods: {
- scan(){
- api.mdfCustomScanQRCode({
- scanLeftRatio: 0.1,
- scanTopRatio: 0.1,
- scanWidthRatio: 0.8,
- scanHeightRatio: 0.4,
- callback: function(res, callback) {
- console.log(JSON.stringify(res));
- //要使连续扫码生效,必须调用 callback 回调发起下一次扫码。
- typeof callback === 'function' && callback();
- }
- });
- },
- }
- }
- </script>
- <style>
- .main{
- /*让白色部分占据剩余区域,父容器的布局默认为纵轴的flex布局,所以这个直接生效*/
- flex: 1;
- background-color: white;
- }
- .page {
- height: 100%;
- background-color: #25292e;
- }
- .top{
- height: 2.5rem;
- text-align: center;
- justify-content: center;
- margin-top: 1.875rem;
- }
- .top-title{
- color: white;
- font-weight: 500;
- }
- </style>
复制代码 |
|