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; 后,避首标点就只能独自在行首了。
愿你以渺小起航,以伟大结尾!