Taro.createCanvasContext
报错:canvasToTempFilePath: fail canvas is empty
微信小程序中wx.createCanvasContext({},this)
、参数一是配置项,[参数二表示当前组件范围]
(参数二在自定义组件中必须指定,小程序中只需要传入当前this
)
Taro中Taro.createCanvasContext({},this.$scope)
、参数传法不变,参数二需要传入this.$scope
wx.canvasToTempFilePath({},this) 、wx.canvasPutImageData({},this)...
同上
Taro多行文本溢出显示省略号 (失效问题)
.text{
word-break: break-all;
display: -webkit-box;
/*! autoprefixer: ignore next */
-webkit-box-orient: vertical;
-webkit-line-clamp:3;
overflow: hidden;
text-overflow:ellipsis;
}
因为Taro 的css使用了autoprefixer
,autoprefixer
默认会移除掉废弃、过时的css样式所以给
-webkit-box-orient
加上/*! autoprefixer: ignore next */
吧
参考:https://github.com/postcss/autoprefixer/issues/776#issuecomment-392328402
微信小程序苹果手机(IOS)请求接口地址报错404,安卓以及开发者工具可以正常请求
原因:请求后面多了一个空格,安卓和微信开发者工具会忽略掉地址结尾的空格,而苹果手机不会
全局路由地址变化事件
eventCenter.on('__taroRouterChange', ({ fromLocation, toLocation }) => {});
单位转换
rpx转px:
const px = wx.getSystemInfoSync().windowWidth / 750 * 1;
px转rpx:
const rpx = 750 / wx.getSystemInfoSync().windowWidth * 1;
网友评论