{"action":"created","issue":{"url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1267","repository_url":"https://api.github.com/repos/RubyLouvre/avalon","labels_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1267/labels{/name}","comments_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1267/comments","events_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1267/events","html_url":"https://github.com/RubyLouvre/avalon/issues/1267","id":135611497,"number":1267,"title":"通过代码设置 select 值，如何双向绑定？","user":{"login":"treenew","id":745376,"avatar_url":"https://avatars.githubusercontent.com/u/745376?v=3","gravatar_id":"","url":"https://api.github.com/users/treenew","html_url":"https://github.com/treenew","followers_url":"https://api.github.com/users/treenew/followers","following_url":"https://api.github.com/users/treenew/following{/other_user}","gists_url":"https://api.github.com/users/treenew/gists{/gist_id}","starred_url":"https://api.github.com/users/treenew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/treenew/subscriptions","organizations_url":"https://api.github.com/users/treenew/orgs","repos_url":"https://api.github.com/users/treenew/repos","events_url":"https://api.github.com/users/treenew/events{/privacy}","received_events_url":"https://api.github.com/users/treenew/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-02-23T02:37:21Z","updated_at":"2016-02-23T02:38:19Z","closed_at":null,"body":"以下是代码：\r\n```html\r\n<!DOCTYPE html>\r\n<html>\r\n<head>\r\n    <title>测试</title>\r\n</head>\r\n<body ms-controller=\"default\">\r\n    <select id=\"demo\" ms-duplex=\"item.type\">\r\n        <option value=\"A\">3000-5000</option>\r\n        <option value=\"B\">5000-8000</option>\r\n        <option value=\"C\">8000-10000</option>\r\n        <option value=\"D\">10000-15000</option>\r\n    </select>\r\n\r\n    <script type=\"text/javascript\" src=\"jquery-1.8.3.js\"></script>\r\n    <script type=\"text/javascript\" src=\"avalon.shim.js\"></script>\r\n    <script>\r\n        $(function () {\r\n            var model = { type: 'C' };\r\n            var vm = avalon.define({\r\n                $id: 'default',\r\n                item: model\r\n            });\r\n            window.vModel = vm;\r\n        });\r\n    </script>\r\n</body>\r\n</html>\r\n```\r\n打开这个页面到浏览器以后，\r\n分别执行以下三句 js 代码\r\n\r\n```js\r\n$(\"#demo\").val('A').change();\r\nvModel.item.type;\r\n$(\"#demo\").val();\r\n```\r\n\r\n现在想要实现的效果是，第三方插件通过jquery.val 之类的方法修改了 select，那么如何让*vModel.item.type*也自动更新？"},"comment":{"url":"https://api.github.com/repos/RubyLouvre/avalon/issues/comments/187491136","html_url":"https://github.com/RubyLouvre/avalon/issues/1267#issuecomment-187491136","issue_url":"https://api.github.com/repos/RubyLouvre/avalon/issues/1267","id":187491136,"user":{"login":"treenew","id":745376,"avatar_url":"https://avatars.githubusercontent.com/u/745376?v=3","gravatar_id":"","url":"https://api.github.com/users/treenew","html_url":"https://github.com/treenew","followers_url":"https://api.github.com/users/treenew/followers","following_url":"https://api.github.com/users/treenew/following{/other_user}","gists_url":"https://api.github.com/users/treenew/gists{/gist_id}","starred_url":"https://api.github.com/users/treenew/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/treenew/subscriptions","organizations_url":"https://api.github.com/users/treenew/orgs","repos_url":"https://api.github.com/users/treenew/repos","events_url":"https://api.github.com/users/treenew/events{/privacy}","received_events_url":"https://api.github.com/users/treenew/received_events","type":"User","site_admin":false},"created_at":"2016-02-23T02:38:18Z","updated_at":"2016-02-23T02:38:18Z","body":"输出结果是：\r\n```\r\nJquery 对象\r\nC\r\nA\r\n```"}}