{"action":"created","issue":{"url":"https://api.github.com/repos/ElemeFE/element/issues/8465","repository_url":"https://api.github.com/repos/ElemeFE/element","labels_url":"https://api.github.com/repos/ElemeFE/element/issues/8465/labels{/name}","comments_url":"https://api.github.com/repos/ElemeFE/element/issues/8465/comments","events_url":"https://api.github.com/repos/ElemeFE/element/issues/8465/events","html_url":"https://github.com/ElemeFE/element/issues/8465","id":276313043,"number":8465,"title":"[Feature Request] Bind the context on the date picker options","user":{"login":"nWidart","id":882397,"avatar_url":"https://avatars3.githubusercontent.com/u/882397?v=4","gravatar_id":"","url":"https://api.github.com/users/nWidart","html_url":"https://github.com/nWidart","followers_url":"https://api.github.com/users/nWidart/followers","following_url":"https://api.github.com/users/nWidart/following{/other_user}","gists_url":"https://api.github.com/users/nWidart/gists{/gist_id}","starred_url":"https://api.github.com/users/nWidart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nWidart/subscriptions","organizations_url":"https://api.github.com/users/nWidart/orgs","repos_url":"https://api.github.com/users/nWidart/repos","events_url":"https://api.github.com/users/nWidart/events{/privacy}","received_events_url":"https://api.github.com/users/nWidart/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-11-23T09:44:10Z","updated_at":"2017-11-23T13:37:43Z","closed_at":"2017-11-23T10:13:31Z","author_association":"NONE","body":"<!-- generated by https://eleme-issue.surge.sh DO NOT REMOVE -->\r\n\r\n### Existing Component\r\nYes\r\n\r\n### Component Name\r\nDatePicker\r\n\r\n### Description\r\nHello,\r\n\r\nFor the datepicker component, when using the picker-options attribute, it would be nice to bind the current context inside the options.\r\nFor example:\r\n\r\n```js\r\npickerOptions1: {\r\n  disabledDate(time) {\r\n  \tconsole.log(this.myDates);\r\n    return time.getTime() > Date.now();\r\n  },\r\n},\r\n```\r\n`this`, is not equal to the current vue instance. Full example here: https://jsfiddle.net/NicolasW/cm4ftkc0/1/\r\nThus, it's not possible to access properties and methods inside the options object.\r\n\r\nHowever, this works: https://jsfiddle.net/cm4ftkc0/2/\r\n\r\n```js\r\npickerOptions1: {\r\n  disabledDate: function(time) {\r\n  \tconsole.log(this.myDates);\r\n    return time.getTime() > Date.now();\r\n  }.bind(this),\r\n},\r\n```\r\n\r\nIt's using the long version   calling `bind` manually.\r\n\r\nThanks,\r\n\r\n<!-- generated by https://eleme-issue.surge.sh DO NOT REMOVE -->\r\n"},"comment":{"url":"https://api.github.com/repos/ElemeFE/element/issues/comments/346620450","html_url":"https://github.com/ElemeFE/element/issues/8465#issuecomment-346620450","issue_url":"https://api.github.com/repos/ElemeFE/element/issues/8465","id":346620450,"user":{"login":"nWidart","id":882397,"avatar_url":"https://avatars3.githubusercontent.com/u/882397?v=4","gravatar_id":"","url":"https://api.github.com/users/nWidart","html_url":"https://github.com/nWidart","followers_url":"https://api.github.com/users/nWidart/followers","following_url":"https://api.github.com/users/nWidart/following{/other_user}","gists_url":"https://api.github.com/users/nWidart/gists{/gist_id}","starred_url":"https://api.github.com/users/nWidart/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nWidart/subscriptions","organizations_url":"https://api.github.com/users/nWidart/orgs","repos_url":"https://api.github.com/users/nWidart/repos","events_url":"https://api.github.com/users/nWidart/events{/privacy}","received_events_url":"https://api.github.com/users/nWidart/received_events","type":"User","site_admin":false},"created_at":"2017-11-23T13:37:43Z","updated_at":"2017-11-23T13:37:43Z","author_association":"NONE","body":"Ok, thank you for the explanation. 👍 "}}
{"actor":{"display_login":"nWidart"}}