Answer a question

I have been vuetify's <v-tooltip> and I don't find any attributes in their API so I could either use \n or <br /> to create a newline inside the tooltip template.

Exemple :

    <v-tooltip>
      <template v-slot:activator="{ on }">
        <v-btn>
          button
        </v-btn>
      </template>
      <span>First line \n second line</span>
    </v-tooltip>

This will still display

First line second line

instead of

First line 
second line

Answers

Insert p tags instead of spans, this will separate on to two lines.

Added mb-0 to remove excess spacing.

<!DOCTYPE html>
<html>
<head>
  <link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/@mdi/font@4.x/css/materialdesignicons.min.css" rel="stylesheet">
  <link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet">
  <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, minimal-ui">
</head>
<body>
  <div id="app">
    <v-app>
      <v-main>
        <v-tooltip bottom>
          <template v-slot:activator="{ on, attrs }">
            <v-btn
              color="primary"
              dark
              v-bind="attrs"
              v-on="on"
            >
              Button
            </v-btn>
          </template>
          <p>Tooltip</p>
          <p class="mb-0">Tooltip2</p>
        </v-tooltip>
      </v-main>
    </v-app>
  </div>

  <script src="https://cdn.jsdelivr.net/npm/vue@2.x/dist/vue.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.js"></script>
  <script>
    new Vue({
      el: '#app',
      vuetify: new Vuetify(),
    })
  </script>
</body>
</html>
Logo

前往低代码交流专区

更多推荐