A
A
Aleksandr_KH2019-05-21 09:30:41
Vue.js
Aleksandr_KH, 2019-05-21 09:30:41

How to add custom class for Material Vue Component?

How to add a custom class, for example for Select Material Vue?

<md-field>
    <label for="movies">Movies</label>
    <md-select class="test" v-model="selectedMovies" name="movies" id="movies" multiple>
        <md-option value="fight-club">Fight Club</md-option>
        <md-option value="godfather">Godfather</md-option>
        <md-option value="godfather-ii">Godfather II</md-option>
        <md-option value="godfather-iii">Godfather III</md-option>
        <md-option value="godfellas">Godfellas</md-option>
        <md-option value="pulp-fiction">Pulp Fiction</md-option>
        <md-option value="scarface">Scarface</md-option>
    </md-select>
</md-field>

The option to add in the forehead, as I did above class='test', did not work. Looked through the dock, too, could not find anything.

The select itself .

Answer the question

In order to leave comments, you need to log in

2 answer(s)
0
0xD34F, 2019-05-21
@0xD34F Vue.js

The option to add in the forehead, as I did above class='test', did not work.

bullshit
UPD. Taken from the comments:
This class was applied to input. And I need to apply a class to the select itself, which appears before the closing body tag.

Judging by the documentation, this possibility is not provided. When examining the source code of the component , an undocumented mdClass parameter was found, the value of which is added to the root element of the drop-down list as a class.
You can use it at your own risk .
Also keep in mind that since the dropdown is rendered outside of the component's root element, the css class being added must be declared in a non-scoped style section.

A
Alexander Drozdov, 2019-05-21
@bagzon

Everything is added https://codesandbox.io/s/vue-material-multiple-sel...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question