uni-app问题记录

一、启动问题记录

1. 报错1

在这里插入图片描述
解决办法:
开启微信开发者工具服务端口
在这里插入图片描述

2. 报错2:调用getLocation获取位置信息时报错以下内容

{errMsg: “getLocation:fail the api need to be declared in the requiredPrivateInfos field in app.json/ext.json”}
解决办法:
manifest.json文件配置以下内容

"mp-weixin":{
    "permission": {
      "scope.userLocation": {
        "desc": "你的位置信息将用于小程序接口效果展示"
      }
    },
    "requiredPrivateInfos": ["getLocation"]
}

二、问题记录

1. uniapp引入utlis里面统一方法,script中可以正常使用,但是在template报错方法undefined

解决办法:
在script中引入utils文件,并将需要使用的方法暴露出来。例如:

import { method1, method2 } from '@/utils/utils.js';
export default {
  methods: {
    method1,
    method2,
  },
};

在template中使用方法时,使用this来调用方法。例如:

<template>
  <div>
    <button @click="method1">调用方法1</button>
    <button @click="method2">调用方法2</button>
  </div>
</template>

三、兼容性问题记录

1. overflow:hidden在ios不生效

解决办法: 在父级元素加上position:relative 或 position: fixed;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值