How the Movable-view of a small program keeps moving

Source: Internet
Author: User

In the official case of the applet, click the button after the Movable-view just moved once (link: https://mp.weixin.qq.com/debug/wxadoc/dev/component/ movable-view.html), then I would like to move one more distance per click How to get:

Wxml:

<view class= "section" >  <view class= "Section__title" >movable-view area less than movable-area</view>  <movable-area style= "height:200px;width:200px;background:red;" >    <movable-view style= "height:50px; width:50px; background:blue;" x= "{{x}}" y= "{{y}}" direction= "All" >< c3/></movable-view>  </movable-area>  <view class= "Btn-area" >    <button size= "Mini" bindtap= "Taps" >click me to Move to (30px, 30px) </button>  </view>

Js:

Page ({  data: {    x:0,    y:0  },  taps:function (e) {let    num = ten;    Console.log (this.data.x);    This.setdata ({      x:this.data.x+num,      y:this.data.x+num    });}  )

This will enable the function

How the Movable-view of a small program keeps moving

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.