{"action":"created","issue":{"url":"https://api.github.com/repos/wepyjs/wepy/issues/164","repository_url":"https://api.github.com/repos/wepyjs/wepy","labels_url":"https://api.github.com/repos/wepyjs/wepy/issues/164/labels{/name}","comments_url":"https://api.github.com/repos/wepyjs/wepy/issues/164/comments","events_url":"https://api.github.com/repos/wepyjs/wepy/issues/164/events","html_url":"https://github.com/wepyjs/wepy/issues/164","id":231612153,"number":164,"title":"在<input/>的@input的回调中返回值无法替换输入框的内容","user":{"login":"Atuna","id":2631124,"avatar_url":"https://avatars2.githubusercontent.com/u/2631124?v=3","gravatar_id":"","url":"https://api.github.com/users/Atuna","html_url":"https://github.com/Atuna","followers_url":"https://api.github.com/users/Atuna/followers","following_url":"https://api.github.com/users/Atuna/following{/other_user}","gists_url":"https://api.github.com/users/Atuna/gists{/gist_id}","starred_url":"https://api.github.com/users/Atuna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Atuna/subscriptions","organizations_url":"https://api.github.com/users/Atuna/orgs","repos_url":"https://api.github.com/users/Atuna/repos","events_url":"https://api.github.com/users/Atuna/events{/privacy}","received_events_url":"https://api.github.com/users/Atuna/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-05-26T12:23:16Z","updated_at":"2017-05-27T03:38:02Z","closed_at":null,"body":"```\r\n// index.wepy\r\n<style lang=\"less\">\r\n</style>\r\n\r\n<template>\r\n  <input @input=\"bindReplaceInput\" placeholder=\"连续的两个1会变成2\" />\r\n</template>\r\n\r\n<script>\r\nimport wepy from 'wepy'\r\n\r\nexport default class ProfileForm extends wepy.page {\r\n  bindReplaceInput (e) {\r\n    var value = e.detail.value\r\n    var pos = e.detail.cursor\r\n    if (pos !== -1) {\r\n      var left = e.detail.value.slice(0, pos)\r\n      pos = left.replace(/11/g, '2').length\r\n    }\r\n    console.log('trigger')\r\n    return {\r\n      value: value.replace(/11/g, '2'),\r\n      cursor: pos\r\n    }\r\n  }\r\n}\r\n</script>\r\n```\r\n今天尝试将input组件里的值进行替换，按照官方的文档里的写法，却无法替换（11变成2）\r\n但是console里有打印出“trigger”（证明回调有触发）。\r\n当尝试将官方的[demo](https://mp.weixin.qq.com/debug/wxadoc/dev/component/input.html)里的js代码替换dist/index.js里编译后的代码，就可以触替换输入框里的内容。\r\n\r\n请问这是一个bug吗？还是我的写法有问题？\r\n希望有人可以指导一下，先谢谢了：）"},"comment":{"url":"https://api.github.com/repos/wepyjs/wepy/issues/comments/304424485","html_url":"https://github.com/wepyjs/wepy/issues/164#issuecomment-304424485","issue_url":"https://api.github.com/repos/wepyjs/wepy/issues/164","id":304424485,"user":{"login":"Atuna","id":2631124,"avatar_url":"https://avatars2.githubusercontent.com/u/2631124?v=3","gravatar_id":"","url":"https://api.github.com/users/Atuna","html_url":"https://github.com/Atuna","followers_url":"https://api.github.com/users/Atuna/followers","following_url":"https://api.github.com/users/Atuna/following{/other_user}","gists_url":"https://api.github.com/users/Atuna/gists{/gist_id}","starred_url":"https://api.github.com/users/Atuna/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Atuna/subscriptions","organizations_url":"https://api.github.com/users/Atuna/orgs","repos_url":"https://api.github.com/users/Atuna/repos","events_url":"https://api.github.com/users/Atuna/events{/privacy}","received_events_url":"https://api.github.com/users/Atuna/received_events","type":"User","site_admin":false},"created_at":"2017-05-27T03:38:02Z","updated_at":"2017-05-27T03:38:02Z","body":"谢谢，按照你修改已经解决问题。\r\n可是我还有一些疑问，希望能帮助解答。之前我在使用<map>原生组件的@markertap事件的回调函数需要写在methods外面。我参考了[这部分的源码](https://github.com/dolymood/wepy/commit/ca4b9e7eb7fe75a65b4b9ffc69ed3d89d6cf2646#diff-f97d79274e80de6bf3826886d1585f0f)，根据我的理解，如果是原生的组件(isKnowTag)就会用bind的prefix而不是vue的v-on。而input是包含在knowTags里的，所以照理<input>的@input的事件回调来说应该是和<map>的@markertap的一样不应该放在methods里面的。\r\n还望指导，谢谢。\r\n"}}
{"actor":{"display_login":"Atuna"}}