{"action":"created","issue":{"url":"https://api.github.com/repos/RubyLouvre/avalon.oniui/issues/608","labels_url":"https://api.github.com/repos/RubyLouvre/avalon.oniui/issues/608/labels{/name}","comments_url":"https://api.github.com/repos/RubyLouvre/avalon.oniui/issues/608/comments","events_url":"https://api.github.com/repos/RubyLouvre/avalon.oniui/issues/608/events","html_url":"https://github.com/RubyLouvre/avalon.oniui/issues/608","id":70596488,"number":608,"title":"flipswitch组件如何根据值来初始化状态","user":{"login":"wyzfzu","id":5001237,"avatar_url":"https://avatars.githubusercontent.com/u/5001237?v=3","gravatar_id":"","url":"https://api.github.com/users/wyzfzu","html_url":"https://github.com/wyzfzu","followers_url":"https://api.github.com/users/wyzfzu/followers","following_url":"https://api.github.com/users/wyzfzu/following{/other_user}","gists_url":"https://api.github.com/users/wyzfzu/gists{/gist_id}","starred_url":"https://api.github.com/users/wyzfzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wyzfzu/subscriptions","organizations_url":"https://api.github.com/users/wyzfzu/orgs","repos_url":"https://api.github.com/users/wyzfzu/repos","events_url":"https://api.github.com/users/wyzfzu/events{/privacy}","received_events_url":"https://api.github.com/users/wyzfzu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-04-24T06:01:44Z","updated_at":"2015-04-28T07:32:58Z","closed_at":null,"body":"```html\r\n<!DOCTYPE html>\r\n<html>\r\n    <head>\r\n        <title>flipswitch</title>\r\n        <meta charset=\"UTF-8\">\r\n        <meta name=\"viewport\" content=\"width=device-width\">\r\n        <script src=\"../avalon.js\"></script>\r\n    </head>\r\n    <script>\r\n        require(['flipswitch/avalon.flipswitch'], function() {\r\n            var vm = avalon.define({\r\n                $id: 'TestCtrl',\r\n                $skipArray: [\"flipswitch\"],\r\n                name: '',\r\n                status: '',\r\n                flipswitch: {\r\n                    onChange: function(newVal, vmodel) {\r\n                        vm.updateStatus(newVal, vmodel.widgetElement);\r\n                    }\r\n                },\r\n                datas: [\r\n                    {status: 1},\r\n                    {status: 0}\r\n                ],\r\n                updateStatus: function(status, elem) {\r\n                    // 同步更新数据库状态\r\n                }\r\n            });\r\n            avalon.scan();\r\n        });\r\n    </script>\r\n\t<body ms-controller=\"TestCtrl\">\r\n\t\t<table>\r\n\t\t\t<tr ms-repeat=\"datas\">\r\n                <td>{{$index + 1}}</td>\r\n\t\t\t\t<td>\r\n\t\t\t\t\t<input type=\"checkbox\"\r\n\t\t\t\t\t\tms-widget=\"flipswitch\"\r\n\t\t\t\t\t\tdata-flipswitch-size=\"small\"\r\n\t\t\t\t\t\tms-attr-value=\"el.status\"/>\r\n\t\t\t\t</td>\r\n\t\t\t</tr>\r\n\t\t</table>\r\n\t</body>\r\n</html>\r\n```\r\n如上代码，flipswitch组件如何根据el.status来初始化成“开”或“关”，目前只看到有获取checked属性来判断。"},"comment":{"url":"https://api.github.com/repos/RubyLouvre/avalon.oniui/issues/comments/96960375","html_url":"https://github.com/RubyLouvre/avalon.oniui/issues/608#issuecomment-96960375","issue_url":"https://api.github.com/repos/RubyLouvre/avalon.oniui/issues/608","id":96960375,"user":{"login":"wyzfzu","id":5001237,"avatar_url":"https://avatars.githubusercontent.com/u/5001237?v=3","gravatar_id":"","url":"https://api.github.com/users/wyzfzu","html_url":"https://github.com/wyzfzu","followers_url":"https://api.github.com/users/wyzfzu/followers","following_url":"https://api.github.com/users/wyzfzu/following{/other_user}","gists_url":"https://api.github.com/users/wyzfzu/gists{/gist_id}","starred_url":"https://api.github.com/users/wyzfzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wyzfzu/subscriptions","organizations_url":"https://api.github.com/users/wyzfzu/orgs","repos_url":"https://api.github.com/users/wyzfzu/repos","events_url":"https://api.github.com/users/wyzfzu/events{/privacy}","received_events_url":"https://api.github.com/users/wyzfzu/received_events","type":"User","site_admin":false},"created_at":"2015-04-28T07:32:58Z","updated_at":"2015-04-28T07:32:58Z","body":"已解决。"}}