Skip to content

Tooltip 文字提示

基础用法

通过使用v-tooltip指令, 给元素添加文字提示。

<template>
  <div>
    <l-row justify="center">
      <l-button
        status="primary"
        v-tooltip="{
          content: 'This is a two-line tooltip content.This is a two-line tooltip content.',
          position: 'top'
        }"
        >Top</l-button
      >
    </l-row>
    <l-row justify="space-between" :span="24">
      <l-col :span="4">
        <l-button
          status="primary"
          v-tooltip="{
            content: 'This is a two-line tooltip content.This is a two-line tooltip content.',
            position: 'left'
          }"
          >Left</l-button
        >
      </l-col>
      <l-col :span="4">
        <l-button
          status="primary"
          v-tooltip="{
            content: 'This is a two-line tooltip content.This is a two-line tooltip content.',
            position: 'right'
          }"
          >Right</l-button
        >
      </l-col>
    </l-row>
    <l-row justify="center">
      <l-button
        status="primary"
        v-tooltip="{
          content: 'This is a two-line tooltip content.This is a two-line tooltip content.',
          position: 'bottom'
        }"
        >Bottom</l-button
      >
    </l-row>
  </div>
</template>

修饰符用法

通过位置修饰符position来控制文字提示的位置。

<template>
  <div>
    <l-row justify="center">
      <l-button
        status="primary"
        v-tooltip.top="'This is a two-line tooltip content.This is a two-line tooltip content.'"
        >Top</l-button
      >
    </l-row>
    <l-row justify="space-between" :span="24">
      <l-col :span="4">
        <l-button
          status="primary"
          v-tooltip.left="'This is a two-line tooltip content.This is a two-line tooltip content.'"
          >Left</l-button
        >
      </l-col>
      <l-col :span="4">
        <l-button
          status="primary"
          v-tooltip.right="'This is a two-line tooltip content.This is a two-line tooltip content.'"
          >Right</l-button
        >
      </l-col>
    </l-row>
    <l-row justify="center">
      <l-button
        status="primary"
        v-tooltip.bottom="'This is a two-line tooltip content.This is a two-line tooltip content.'"
        >Bottom</l-button
      >
    </l-row>
  </div>
</template>

Tooltip API

Options

属性名描述类型默认值
content文字提示内容string-
position文字提示位置stringtop
delay延迟显示时间number100

鲁ICP备2024093316号