N
N
Natalia2019-08-02 10:58:11
JavaScript
Natalia, 2019-08-02 10:58:11

Screen resolution condition in Vue.js?

Good afternoon!
Can you please tell me how to correctly write an inline condition in the component: If the screen width is more than 700, then define :item-size="46", if the width is less than 699, then :item-size="56" ?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2019-08-02
@lota

:item-size="itemSize"

data: () => ({
  itemSize: null,
}),
methods: {
  onResize() {
    this.itemSize = document.documentElement.clientWidth > 700 ? 46 : 56;
  },
},
created() {
  window.addEventListener('resize', this.onResize);
  this.onResize();
},
beforeDestroy() {
  window.removeEventListener('resize', this.onResize);
},

W
WP Panda, 2017-12-01
@dmNAr

None,
They have this inserted through ifame https://quiz.lifehacker.ru/tests/220
On what it is, xs but plugins for tests 100500
https://ru.wordpress.org/plugins/tags/quiz/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question