recherche

Maison  >  Questions et réponses  >  le corps du texte

Je veux créer un champ de texte dans vuetify

https://i.stack.imgur.com/zbCfI.png

Je souhaite créer un champ de texte dans vuetify, mais le bouton ne peut pas être créé comme ça ? Et la hauteur, mais elle ne peut pas être modifiée ? J'ai essayé de changer la hauteur plusieurs fois mais ça ne marche pas

J'ai déjà le CSS mais c'est difficile à utiliser sur vuetify

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

.parent-box{

  width:fit-content;

  background:#26376B;

}

.text-box{

  border:1px solid #CACACA;

  padding:5px 10px;

  min-width:300px;

}

.btn{

  padding:5px 20px;

  width:100px;

  color:#fff;

  border:none;

  background-color:#26376B;

  cursor:pointer;

}

.common{

  outline:none;

  border-radius:50px;

}

 

<div class="parent-box common">

  <input class="text-box common" type="text" placeholder="Chassis Number">

  <button class="btn common">Check</button>

</div>

P粉323224129P粉323224129378 Il y a quelques jours517

répondre à tous(2)je répondrai

  • P粉482108310

    P粉4821083102024-02-27 09:07:03

    Quelque chose de similaire peut être fait comme ceci :

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    22

    23

    24

    25

    26

    27

    28

    29

    30

    31

    32

    33

    34

    35

    36

    ...

    <v-container>

      <v-layout wrap="" class="parent-box common">

        <v-text-field class="text-field__styled" outlined="" rounded="" dense="" color="#26376B" placeholder="Chassis Number" height="27" hide-details=""></v-text-field>

        <button class="btn__styled">Check</button>

      </v-layout>

    </v-container>

     

    ...

     

    <style>

    .parent-box {

      background: #26376B;

      width: 400px;

    }

     

    .common {

      outline: none;

      border-radius: 20px;

    }

     

    .text-field__styled {

      background: #fff;

    }

     

    .btn__styled {

      color: #fff;

      width: 100px;

    }

     

    .v-text-field .v-input__control .v-input__slot {

      min-height: auto !important;

      display: flex !important;

      align-items: center !important;

    }

    </style>

    Découvrezce CodePen

    De nombreux styles peuvent être personnalisés dans vuetify via props. Mais par défaut, vuetify s'inspire du Material Design, et contrairement à votre exemple, personnaliser les styles par défaut n'est pas si simple. Pour votre cas, il serait peut-être préférable d'appliquer un thème vuetify avant d'utiliser cette bibliothèque.

    répondre
    0
  • P粉819937486

    P粉8199374862024-02-27 00:13:17

    Énoncé du problème : Vous souhaitez créer un champ de texte avec un bouton dans Vuetify.

    Solution :

    HTML :

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    13

    14

    15

    16

    17

    18

    19

    20

    21

    <v-app id="app">

     

      <v-container>

       

        <v-text-field label="Chassis Number" color="primary" v-model="input" @keypress.enter="show">

       

           <template v-slot:append="">

       

              <v-btn depressed="" tile="" color="primary" class="ma-0" @click="show">

               

                show

                 

              </v-btn>

             

          </template>

             

        </v-text-field>

           

      </v-container>

       

    </v-app>

    Vue.js :

    1

    2

    3

    4

    5

    6

    7

    8

    9

    10

    11

    12

    new Vue({

      el: "#app",

        vuetify: new Vuetify(),

      data: {

        input: ''

      },

      methods: {

        show(){

          alert(this.input)

        }

      }

    })

    Sortie :

    répondre
    0
  • Annulerrépondre