<template>
<gracePage :customHeader="false">
<view slot="gBody" class="grace-body">
<view class="grace-title grace-margin-top">
<view class="grace-title-border"></view>
<text class="grace-title-text grace-blue">单指操作</text>
<text class="grace-text-small grace-gray">grace.hcoder.net</text>
</view>
<view class="grace-margin-top">
<graceTouch @thStart="thStart" @thMove="thMove" @thEnd="thEnd" @swipe="swipe" @tapme="tapme">
<view class="demo grace-bg-blue grace-text-center">{{moveInfo}}</view>
</graceTouch>
</view>
<view class="grace-title grace-margin-top">
<view class="grace-title-border"></view>
<text class="grace-title-text grace-blue">双指缩放</text>
<text class="grace-text-small grace-gray">grace.hcoder.net</text>
</view>
<view class="grace-margin-top">
<graceTouch @scale="scale">
<view class="demo grace-bg-blue grace-text-center">{{moveInfo2}}</view>
</graceTouch>
</view>
</view>
</gracePage>
</template>
<script>
import gracePage from "../../graceUI/components/gracePage.vue";
import graceTouch from "../../graceUI/components/graceTouch.vue";
export default {
data() {
return {
moveInfo : '滑动手指试试 (:',
moveInfo2 : '请双指缩放试试'
}
},
methods:{
thStart : function(e){
this.moveInfo = "start : " + JSON.stringify(e);
},
thMove : function (e){
this.moveInfo = "move : " + JSON.stringify(e);
},
thEnd : function(e){
this.moveInfo = "end : " + JSON.stringify(e);
},
scale : function(e){
this.moveInfo2 = "scale : " + JSON.stringify(e) + '倍';
},
swipe : function(direction){
uni.showToast({ title:"向 " + direction + ' 滑动', icon:"none"});
},
tapme : function () {
uni.showToast({ title:"点击事件", icon:"none"});
}
},
components:{gracePage, graceTouch}
}
</script>
<style>
.demo{width:700rpx; padding:200rpx 0;}
</style>
<template>
<gracePage :customHeader="false">
<view slot="gBody" class="grace-body">
<view class="grace-title grace-margin-top">
<view class="grace-title-border"></view>
<text class="grace-title-text grace-blue">单指操作</text>
<text class="grace-text-small grace-gray">grace.hcoder.net</text>
</view>
<view class="grace-margin-top">
<graceTouch @thStart="thStart" @thMove="thMove" @thEnd="thEnd" @swipe="swipe" @tapme="tapme">
<text class="demo grace-bg-blue grace-text-center">{{moveInfo}}</text>
</graceTouch>
</view>
<view class="grace-title grace-margin-top">
<view class="grace-title-border"></view>
<text class="grace-title-text grace-blue">双指缩放</text>
<text class="grace-text-small grace-gray">grace.hcoder.net0</text>
</view>
<view class="grace-margin-top">
<graceTouch @scale="scale">
<text class="demo grace-bg-blue grace-text-center">{{moveInfo2}}</text>
</graceTouch>
</view>
</view>
</gracePage>
</template>
<script>
import gracePage from "../../graceUI/weexComponents/gracePage.nvue";
import graceTouch from "../../graceUI/weexComponents/graceTouch.nvue";
export default {
data() {
return {
moveInfo : '滑动手指试试 (:',
moveInfo2 : '请双指缩放试试'
}
},
methods:{
thStart : function(e){
this.moveInfo = "start : " + JSON.stringify(e);
},
thMove : function (e){
this.moveInfo = "move : " + JSON.stringify(e);
},
thEnd : function(e){
this.moveInfo = "end : " + JSON.stringify(e);
},
scale : function(e){
this.moveInfo2 = "scale : " + JSON.stringify(e) + '倍';
},
swipe : function(direction){
uni.showToast({ title:"向 " + direction + ' 滑动', icon:"none"});
},
tapme : function () {
uni.showToast({ title:"点击事件", icon:"none"});
}
},
components:{gracePage, graceTouch}
}
</script>
<style>
.demo{width:700rpx; padding-top:200rpx; padding-bottom:200rpx;}
</style>
.wxml
<gracePage :customHeader="false">
<view slot="gBody" class="grace-body">
<view class="grace-title grace-margin-top">
<view class="grace-title-border"></view>
<text class="grace-title-text grace-blue">单指操作</text>
<text class="grace-text-small grace-gray">grace.hcoder.net</text>
</view>
<view class="grace-margin-top">
<graceTouch bind:thStart="thStart" bind:thMove="thMove" bind:thEnd="thEnd" bind:swipe="swipe" bind:tapme="tapme">
<view class="demo grace-bg-blue grace-text-center">{{moveInfo}}</view>
</graceTouch>
</view>
<view class="grace-title grace-margin-top">
<view class="grace-title-border"></view>
<text class="grace-title-text grace-blue">双指缩放</text>
<text class="grace-text-small grace-gray">grace.hcoder.net</text>
</view>
<view class="grace-margin-top">
<graceTouch bind:scale="scale">
<view class="demo grace-bg-blue grace-text-center">{{moveInfo2}}</view>
</graceTouch>
</view>
</view>
</gracePage>.js
Page({
data: {
moveInfo : '滑动手指试试 (:',
moveInfo2 : '请双指缩放试试'
},
thStart : function(e){
e = e.detail;
this.setData({moveInfo : "start : " + JSON.stringify(e)});
},
thMove : function (e){
e = e.detail;
this.setData({moveInfo : "move : " + JSON.stringify(e)});
},
thEnd : function(e){
e = e.detail;
this.setData({moveInfo : "end : " + JSON.stringify(e)});
},
scale : function(e){
e = e.detail;
this.setData({moveInfo2 : "scale : " + JSON.stringify(e[0]) + '倍'});
},
swipe : function(direction){
direction = direction.detail;
wx.showToast({ title:"向 " + direction + ' 滑动', icon:"none"});
},
tapme : function () {
wx.showToast({ title:"点击事件", icon:"none"});
}
}).json
{
"usingComponents": {
"gracePage" : "../../graceUI/components/gracePage",
"graceTouch": "../../graceUI/components/graceTouch"
}
}.wxss
.demo{width:700rpx; padding:200rpx 0;}