微信小程序_原生+TypeScript_采坑计

1. Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. No index signature with a parameter of type 'string' was found on type '{}'.

大意:参数是string类型,不能作为对象的索引。

解决办法:在 tyconfig.json 中添加 "suppressImplicitAnyIndexErrors": true

2. An async function or method in ES5/ES3 requires the 'Promise' constructor. Make sure you have a declaration for the 'Promise' constructor or include 'ES2015' in your `--lib` option.

大意:因为 async/await 是 ES6 中引入的,ES3/ES5不支持

解决办法:在 tyconfig.json 中添加 "lib": ["ES2015"] ,注意必须是 "ES2015"

3. Property 'xxx' does not exist

commonbury: function (param: object) {
  (this as any).setData({
      burying_data: JSON.stringify(this.queryBuryData(param)),
  })
}

4. 表单元素占位符类名 placeholder-class 设置不生效 ?

placeholder-class 只能设置 placeholder 的 大小 颜色 加粗

边距等会跟随控件一起变化,所以可以通过给控件设置 padding 来实现

5. 表单提交,需要使用 catchsubmit="" 绑定方法,这样不会出现输入大写,不确定,取不到值的情况。

<form catchsubmit="formSubmit">
    <button class="button" formType="submit">提交</button>
</form>

6. 安卓机,textarea 输入某些中文标点,不换行

因为:有些避首标点避尾标点可能导致无法换行。可用样式解决:

line-break: anywhere; /* 任意位置都换行。亲测有效*/

但是这样还有个小问题:避首标点 比如句号如果正好应该在行首的话,那么句号前一个字应随句号一起换行,如下图

设置 line-break: anywhere; 后,避首标点就只能独自在行首了。

 

 

愿你以渺小起航,以伟大结尾!

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值