Taro 遇到的坑
1.createSelectorQuery无法获取节点宽高
//创建节点选择器
var query = wx.createSelectorQuery();
//选择id
var that = this;
query.select('.content').boundingClientRect(function (rect) {
console.log(rect)
}).exec();
父组件:
import Taro, { Component } from '@tarojs/taro'
import { View } from '@tarojs/components'
import Child from '../../components/child/child' export default class PageView extends Component {
render () {
return <View>
<Child></Child>
</View>
}
}
子组件:
import Taro, { Component } from '@tarojs/taro'
import { View } from '@tarojs/components' export default class Child extends Component {
componentDidMount () {
const query = Taro.createSelectorQuery().in(this.$scope)
query.select('.line').boundingClientRect().exec(res => {
console.log(res);
})
} render() {
return (
<View class='line'>我是有底线的~</View>
)
}
}
2.
Taro 遇到的坑的更多相关文章
- Taro 开发踩坑指南 (小程序,H5, RN)
Taro 开发踩坑指南 (小程序,H5, RN) css taro 如何展示多行文本省略号 https://www.cnblogs.com/xgqfrms/p/12569057.html UI 设计稿 ...
- 小程序 & taro 踩坑指南
小程序 & taro 踩坑指南 微信开发者工具, 不支持 react bug https://github.com/NervJS/taro/issues/5042 solution just ...
- taro 填坑之路(三)taro 缓存
1.taro 缓存 /** * 缓存数据 H5 小程序 * {food.id:{菜品信息 Num}, } */ import Taro from '@tarojs/taro'; // 取值 let s ...
- taro 填坑之路(一)taro 项目回顾
(1)像素写法 PX -- 大写,否则会自动成rem (2)拿取列表第一条数据 let { activity:[firstItem] } = this.state; (3)使用props 需要设置默认 ...
- Taro踩坑记录一: swiper组件pagestate定制,swiperChange中setState导致组件不能滚动。
import Taro, { Component } from '@tarojs/taro'; import { Swiper, SwiperItem, Image, View } from '@ta ...
- taro 填坑之路(二)taro 通过事件监听 实现组件间传值
1.组件传值的方式 2.事件监听原理 3.事件管理器 utils/event.js /** * 事件池(事件管理器) * 通过事件监听传值 */ class Event { constructor() ...
- Taro 采坑日常
组件事件传参只能在类作用域下的确切引用(this.handleXX || this.props.handleXX),或使用 bind. 组件中点击事件如下 // 组件 <AtListItem k ...
- 小程序第三方框架对比 ( wepy / mpvue / taro )(转)
文章转自 https://www.cnblogs.com/Smiled/p/9806781.html 众所周知如今市面上端的形态多种多样,手机Web.ReactNative.微信小程序, 支付宝小程 ...
- taro Object(...) is not a function 版本更新后,H5端运行出错
之前使用taro,版本号1.2.11 会有这样的问题,如下:gitHub找解决的,看到大佬们说更新一下版本就好了,果然更新后,此问题解决OK了. 当然,坑是走不完的,版本也更新挺快的,想着把taro和 ...
随机推荐
- Eclipse连接数据库报错Local variable passwd defined in an enclosing scope must be final or effectively final
其实原因很简单,就是翻译的结果 匿名内部类和局部内部类只能引用外部的fianl变量 把变量变成fianl就行了 第一次知道啊 记小本本.......
- Redis基本数据
Redis Redis是一个速度非常快的非关系数据库(NoSql),它可以存储键(key)与五种不同的值(value)之间的映射.可以将存储的内存的键值对数据持久化到硬盘. Redis 数据结构 Re ...
- 文件名后面加(1).text
; //在重复名称后加(序号) while (File.Exists(path)) { if (path.Contains(").")) { int start = path.La ...
- CentOS6.8安装Python3.6.3
1.linux下安装python3 准备编译环境(环境如果不对的话,可能遇到各种问题,比如wget无法下载https链接的文件) yum install zlib-devel bzip2-devel ...
- 嵌套For循环性能优化
请对以下的代码进行优化 for (int i = 0; i < 1000; i++) for (int j = 0; j < 100; j++) for (int k = 0; k < ...
- prototype,__proto__,constructor理解
prototype: 任何函数(箭头函数除外)都具有一个 prototype属性,该属性是一个对象.一般情况下只有声明function的变量才会有(自动生成)prototype这个属性,而functi ...
- Solved: XXX esx.problem.hyperthreading.unmitigated.formatOnHost not found XXX
esxi 出现XXX esx.problem.hyperthreading.unmitigated.formatOnHost not found XXX 问题. 回避方法: 将高级设置-->Us ...
- Vue的三个点es6知识,扩展运算符
Vue中的三个点在不同情境下的意思 操作数组 //里面放自己定义的方法 methods: { /** * 把数组中的元素孤立起来 */ iClick() { let iArray = ['1', '2 ...
- SpringMVC----视图层框架
Spring Web模型-视图-控制器(MVC)框架是围绕DispatcherServlet设计的,DispatcherServlet将接收的请求分派给应用程序.SpringMVC具有配置处理程序映射 ...
- IPC之mqueue.c源码解读
队列的意思应该大家都清楚,不过还有有一些细节的地方不知道,下面是一个队列的源码,因该说这是队列的一部分,不是全部.而且是linux中队列,其他各种OS中队列大同小异. /* * POSIX messa ...