Last active
October 30, 2017 13:46
-
-
Save fraaalk/e6ecef5d8c40f919407cf537fd386497 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <template> | |
| <article | |
| :style="{ height }"> | |
| <button @click="changeHeight"> | |
| </button> | |
| </article> | |
| </template> | |
| <script> | |
| export default { | |
| data() { | |
| return { | |
| height: 'auto', | |
| }; | |
| }, | |
| methods: { | |
| changeHeight() { | |
| this.height = 'auto'; | |
| .... something gets changed, template gets updated ... height should have changed | |
| }, | |
| setHeight() { | |
| this.height = `${this.$el.clientHeight}px`; | |
| } | |
| }, | |
| updated() { | |
| if (this.height === 'auto') { | |
| this.setHeight(); | |
| } | |
| }, | |
| mounted() { | |
| this.height = this.setHeight(); | |
| }, | |
| }; | |
| </script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment