赞
踩
"usingComponents": {
"popover": "/static/popover/popover",//定义到popover.js文件下
"popover-item": "/static/popover-item/popover-item"
}
<view @click="ontag('test)" id='test'>触发语句</view <popover ref="popover" id='popover'> <popover-item @click.native.stop='onClickA' hasline>提示语句</popover-item> </popover> //js中 onReady() { this.popover = this.selectComponent('#popover'); }, methods:{ Totag(id) { //this.popover = this.selectComponent('#popover'); uni.createSelectorQuery().select('#' + id + '').boundingClientRect(res => { this.popover.onDisplay(res); }).exec(); }, onClickA() { this.popover.onHide(); } }
就这样就可以了
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。