1. coverview 中的强制换行
.wrap{
word-break: break-all;
word-wrap:break-word;
white-space:pre-line;
}
2. IOS 阻止页面弹性橡皮筋效果
// taro 为例
import Taro, { Component, Config } from '@tarojs/taro';
export default class HomePage extends Component {
config: Config = {
navigationBarTitleText: '首页',
disableScroll: true, // 这一句
};
}
3. 组件之间的通信方法传递,taro 中需要方法名为 on 开头
container.js
import Child from 'child';
render(){
return <view>
<child></child>
</view>
}
child.js
handleClick(){
this.props.onToggle();
}
render(){
return <view>点击测试</view>
}
4. 微信小程序地图
- 在用户手动缩放地图时,不会自动触发 scale 的变化,如果要将地图缩放到初始大小,scale 值是没有变化的,不会触发页面更新;此时可以略微改变一下 scale 值,加上一个很小的数,如 0.000001
state = {
scale : 10
}
resetScale(){
this.setState({
scale:this.state.scale===10?10.00001:10
})
}
render(){
return (
<map></map>
)
}
- 地图定位不准的问题,尝试使用 gcj02 坐标
Taro.getLocation({
type:'gcj02' // 这里
})
.then(res=>{
let { longitude, latitude } = res;
})
推荐教程:《微信小程序》
微信小程序 TabBar 图标生成技能,使用 Python PIL 绘制简约几何图标(未选中灰、选中绿),自动写入 app.json 配置。适用于“生成 tabBar 图标”、“底部菜单栏图标”、“tab 图标”等指令。










