@tarojs/components
Version:
1 lines • 1.26 kB
JavaScript
import{r as t,c as s,h as i,H as e,g as o}from"./p-dd7a128d.js";import{c as h}from"./p-de951a46.js";import{h as r}from"./p-dbdb9de9.js";import"@tarojs/taro";const n=class{constructor(i){t(this,i),this.onLongPress=s(this,"longpress",7),this.startTime=0,this.animation=void 0,this.hoverClass=void 0,this.hoverStartTime=50,this.hoverStayTime=400,this.hover=!1,this.touch=!1}onTouchStart(){this.hoverClass&&(this.touch=!0,setTimeout((()=>{this.touch&&(this.hover=!0)}),this.hoverStartTime)),this.timeoutEvent=setTimeout((()=>{this.onLongPress.emit()}),350),this.startTime=Date.now()}onTouchMove(){clearTimeout(this.timeoutEvent)}onTouchEnd(){Date.now()-this.startTime<350&&clearTimeout(this.timeoutEvent),this.hoverClass&&(this.touch=!1,setTimeout((()=>{this.touch||(this.hover=!1)}),this.hoverStayTime))}componentDidRender(){r(this.el)}render(){const t=h({[`${this.hoverClass}`]:this.hover});let s={};return this.animation&&(s.animation=this.animation,s["data-animation"]=this.animation),i(e,Object.assign({class:t},s),i("slot",null))}get el(){return o(this)}};n.style="body,html{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}taro-view-core{display:block}";export{n as taro_view_core}