B
B
Beetle2019-09-11 19:33:49
Adaptive design
Beetle, 2019-09-11 19:33:49

How to make responsive components?

For example, there is an accordion on a mobile phone (click to open the text), but on a desktop it will be tabs (tabs)?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
N
Nikita Kit, 2019-09-11
@Jukk

1) We cut the current-device plugin into the vue context . I recommend adding it to the Vue prototype. Through Vue install so that it is always at hand. If you don’t rummage around, google something like creating plugin Vue.install - everything is simple there.
2) We create separately tabs, separately accordions. They must have the same data model by itself.
3) We create a wrapper for tabocordions, And under the root we put

<template v-if='$device.desktop()'><tabs.../></template>
<template v-else><accordions.../></template>

Voila. Depending on the user agent, the view will render the model in the desired view

E
Eduard Shkuta, 2019-09-11
@dyus1

CSS Media Queries

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question