R
R
Ruslan2019-02-05 19:38:45
css
Ruslan, 2019-02-05 19:38:45

How to connect a component to vuetify with its own css so that it only affects the component itself, and not external html?

Hello.
Please tell me the solution to the problem.
Situation:
I am developing a component using vue + vuetify, which should be included in a legacy html page. There was a difficulty with connecting the css of vuetify itself to this component.
What I tried:
Option 1.
css is added in the plugin using the line:
import 'vuetify/src/stylus/app.styl'
The element is used in the root template, like this:

<template>
  <v-app>
    <h2>Test</h2>
    <v-layout row>
      <v-btn color="red">TestButton</v-btn>
      <v-btn color="primary">TestButton2</v-btn>
    </v-layout>
  </v-app>
</template>

The problem with this option is that the css affects the entire html page that the component is included in, the v-app element turns into a full-page-height block, and it needs to take the height of the inner elements.
Option 2 : theoretically, if applied to the component , then the style will be applied only to the component, but in fact the effect is the same as in the first option: what was done in this option: comment out the style connection string in the plugin: //import 'vuetify/ src/stylus/app.styl' in the component add the style scoped tag to make it look like this:
<style scoped></style>


<style scoped>
@import url('../node_modules/vuetify/dist/vuetify.min.css');
</style>

<template>
  <v-app>
    <h2>Test</h2>
    <v-layout row>
      <v-btn color="red">TestButton</v-btn>
      <v-btn color="primary">TestButton2</v-btn>
    </v-layout>
  </v-app>
</template>

Accordingly, the question is how you still need to do it in such a way as to achieve the desired result:
the vuetify component is embedded in an existing html page, in which there is a lot of other html code and which should take up exactly as much as it takes in height (or somehow limit by v-app height).
Thank you for your attention.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2019-02-06
@0xD34F

somehow limit the v-app height

He has a class there, application--wrapcalled, in the styles of which the minimum height is set to 100vh. You can override.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question