Giter Club home page Giter Club logo

Comments (4)

ktmud avatar ktmud commented on July 18, 2024

你接受点击事件的rule怎么写的?
On Jan 2, 2014 9:42 PM, "Angela" [email protected] wrote:

我使用包含的wechat包创建了带有链接的菜单。但是点击的时候没有跳转。查询菜单的时候看起来是对的。Log告诉我请求返回到了我的服务器这里由wechat包处理,因为没有匹配的rule,最后匹配失败。

代码生成的菜单大致是这样的

{ button:
[ { name: 'StuffParent', sub_button:
[ { key: 'FARM_LIST', type: 'click', name: 'StuffStuff' },
{ key: 'RESELLER_LIST', type: 'click', name: 'Stuff1' },
{ url: '"http://example.com"', type: 'view', name: 'Stuff2' },
{ key: 'EVENT_LIST', type: 'click', name: 'Stuff3' } ] } ] }

附加微信调试工具出的菜单截图

[image: screen shot 2014-01-02 at 21 36 21]https://f.cloud.github.com/assets/2039144/1832418/b22b0368-73b3-11e3-8b1c-5dfaf95af34b.png


Reply to this email directly or view it on GitHubhttps://github.com//issues/71
.

from weixin-robot.

sang4lv avatar sang4lv commented on July 18, 2024

点击事件的rule都没有match上啊,一般都是用对象里面有pattern,handler,然后有时候有replies。

from weixin-robot.

ktmud avatar ktmud commented on July 18, 2024

你 match 点击事件的 rule 的 pattern 怎么写的?

得像这样新加一个匹配 event 类消息的 rule ,把 info 重写成文本类消息:

webot.set('click-menu', {
  pattern: function(info) {
    return info.is('event') && info.param.event.toLowerCase() == 'click';
  },
  handler: function(info) {
    info.type = 'text';
    info.text = info.param.eventKey;
  },
});

然后就会继续按正常文本消息的逻辑来匹配 rule 了。注意这段代码必须在所有文本rule定义之前。

from weixin-robot.

xiaok avatar xiaok commented on July 18, 2024

cool,原来可以重写。

from weixin-robot.

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.