{"action":"created","issue":{"url":"https://api.github.com/repos/ElemeFE/element/issues/13135","repository_url":"https://api.github.com/repos/ElemeFE/element","labels_url":"https://api.github.com/repos/ElemeFE/element/issues/13135/labels{/name}","comments_url":"https://api.github.com/repos/ElemeFE/element/issues/13135/comments","events_url":"https://api.github.com/repos/ElemeFE/element/issues/13135/events","html_url":"https://github.com/ElemeFE/element/issues/13135","id":372886380,"node_id":"MDU6SXNzdWUzNzI4ODYzODA=","number":13135,"title":"[Feature Request] Can I init or change the width of the the width?","user":{"login":"chxuzzu","id":30339707,"node_id":"MDQ6VXNlcjMwMzM5NzA3","avatar_url":"https://avatars3.githubusercontent.com/u/30339707?v=4","gravatar_id":"","url":"https://api.github.com/users/chxuzzu","html_url":"https://github.com/chxuzzu","followers_url":"https://api.github.com/users/chxuzzu/followers","following_url":"https://api.github.com/users/chxuzzu/following{/other_user}","gists_url":"https://api.github.com/users/chxuzzu/gists{/gist_id}","starred_url":"https://api.github.com/users/chxuzzu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chxuzzu/subscriptions","organizations_url":"https://api.github.com/users/chxuzzu/orgs","repos_url":"https://api.github.com/users/chxuzzu/repos","events_url":"https://api.github.com/users/chxuzzu/events{/privacy}","received_events_url":"https://api.github.com/users/chxuzzu/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-10-23T09:01:01Z","updated_at":"2018-10-25T13:33:52Z","closed_at":null,"author_association":"NONE","body":"<!-- generated by https://eleme-issue.surge.sh DO NOT REMOVE -->\r\n\r\n### Existing Component\r\n是\r\n\r\n### Component Name\r\ntable\r\n\r\n### Description\r\nI need to change the width of the table's column on different scrren, I had try to add style for the \"th\" and \"td\", but it have no effect. So can I init or change the width of the table column like the \"layout\" component?\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/433052855","html_url":"https://github.com/ElemeFE/element/issues/13135#issuecomment-433052855","issue_url":"https://api.github.com/repos/ElemeFE/element/issues/13135","id":433052855,"node_id":"MDEyOklzc3VlQ29tbWVudDQzMzA1Mjg1NQ==","user":{"login":"coffeeyen","id":39608946,"node_id":"MDQ6VXNlcjM5NjA4OTQ2","avatar_url":"https://avatars2.githubusercontent.com/u/39608946?v=4","gravatar_id":"","url":"https://api.github.com/users/coffeeyen","html_url":"https://github.com/coffeeyen","followers_url":"https://api.github.com/users/coffeeyen/followers","following_url":"https://api.github.com/users/coffeeyen/following{/other_user}","gists_url":"https://api.github.com/users/coffeeyen/gists{/gist_id}","starred_url":"https://api.github.com/users/coffeeyen/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coffeeyen/subscriptions","organizations_url":"https://api.github.com/users/coffeeyen/orgs","repos_url":"https://api.github.com/users/coffeeyen/repos","events_url":"https://api.github.com/users/coffeeyen/events{/privacy}","received_events_url":"https://api.github.com/users/coffeeyen/received_events","type":"User","site_admin":false},"created_at":"2018-10-25T13:33:52Z","updated_at":"2018-10-25T13:33:52Z","author_association":"NONE","body":"> Thanks for your comment, what should I do if I want to set the column's width is \"200px\" on desktop and \"100px\" on mobile?\r\n\r\nyou can check width of the page, then set column width.\r\nfor example:\r\n```javascript\r\nlet w = window.innerWidth || document.body.clientWidth;\r\nlet colWidth = 200;\r\nif(w <= 768){\r\n  colWidth = 100;\r\n}\r\n...\r\n```\r\nif you want set it when page width dynamically change, you can do this on 'resize' event\r\n\r\n```javascript\r\n//add listener when component is created\r\nwindow.addEventListener(\"resize\", this.handleResize);\r\n...\r\n//and do not forget remove it before you destroy component\r\nwindow.removeEventListener(\"resize\", this.handleResize);\r\n```\r\n"}}
{"actor":{"display_login":"coffeeyen"}}