慕后森
可以自己实现以下,你看有没有用touchScale(e){e.preventDefault();//记录变化量//第一根手指varoldTouch1={x:this.touches[0].clientX,y:this.touches[0].clientY};varnewTouch1={x:e.touches[0].clientX,y:e.touches[0].clientY};//第二根手指varoldTouch2={x:this.touches[1].clientX,y:this.touches[1].clientY};varnewTouch2={x:e.touches[1].clientX,y:e.touches[1].clientY};varoldL=Math.sqrt(Math.pow(oldTouch1.x-oldTouch2.x,2)+Math.pow(oldTouch1.y-oldTouch2.y,2));varnewL=Math.sqrt(Math.pow(newTouch1.x-newTouch2.x,2)+Math.pow(newTouch1.y-newTouch2.y,2));varcha=~~(newL-oldL);//根据图片本身大小决定每次改变大小的系数,图片越大系数越小//1px-0.2varcoe=1;coe=coe/this.trueWidth>coe/this.trueHeight?coe/this.trueHeight:coe/this.trueWidth;coe=coe>0.1?0.1:coe;varnum=coe*cha;if(!this.touchNow){this.touchNow=true;if(cha>0){this.scale+=Math.abs(num);}elseif(chaMath.abs(num)?(this.scale-=Math.abs(num)):this.scale;}this.touches=e.touches;setTimeout(()=>{this.touchNow=false;},8);}},