Code Monkey home page Code Monkey logo

Comments (6)

feibird avatar feibird commented on August 21, 2024 2

@liuzhen88
有自带参数events
image
image
文档有很好的例子的

from react-amap.

YongX avatar YongX commented on August 21, 2024

解绑的场景是啥?为了重新绑新的么

from react-amap.

ioslh avatar ioslh commented on August 21, 2024

要解绑也并不是办不到的,当前你可以按照这个 JSFIDDLE 所示的方式进行解绑:

  1. 保存好绑定的函数的引用;
  2. 保存事件绑定的对象实例(如上例中的 this.map);
  3. 在需要解绑的时候直接使用 off 方法。

不过还是想了解一下解绑的场景?因为我觉得单纯是为了不让事件触发的话,可以设置一个 flag 变量,在事件回调内部判断这个 flag,需要解绑的时候改变 flag 就可以了。

from react-amap.

feibird avatar feibird commented on August 21, 2024

对的,虽然对于解绑这个可以利用一个flag来判断,但是如果在复杂的逻辑情况下,维护起来会很臃肿不堪。当然有的话我觉得会更好。

from react-amap.

liuzhen88 avatar liuzhen88 commented on August 21, 2024

@cw19931024 如何添加点击事件的?

from react-amap.

liuzhen88 avatar liuzhen88 commented on August 21, 2024

@cw19931024 谢谢你

from react-amap.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.