纷享销客开发者手册 纷享销客开发者手册
  • APL开发手册
  • PWC开发手册
  • OpenAPI 文档
  • 自定义组件(PC端)
  • 自定义组件(小程序)
  • 自定义插件(PC端)
  • 自定义插件(小程序)
  • 第三方集成插件(H5)
  • API(PC端)
  • API(小程序)
  • Fx DevTools
更新日志
  • 简体中文
  • English
  • 自定义组件(PC端)
  • 自定义组件(小程序)
  • 自定义插件(PC端)
  • 自定义插件(小程序)
  • 第三方集成插件(H5)
  • API(PC端)
  • API(小程序)
  • Fx DevTools
更新日志
  • 简体中文
  • English
  • 入门

  • 组件

    • 组件总览
    • UI组件

      • 按钮
      • 单选框
      • 多选框
      • 输入框
      • 计数器
      • 选择器
      • 级联选择器
      • 开关
      • 时间选择器
      • 日期选择器
      • 日期时间选择器
      • 上传
      • 颜色选择器
      • 表格
      • 标签
      • 进度条
      • 树形控件
      • 分页
      • 标记
      • 警告
      • 消息提示
      • 弹框
      • 通知
      • 下拉菜单
      • 步骤条
      • 对话框
      • 卡片
      • 日历
      • 文字提示
        • 弹出框
        • 折叠面板
        • 走马灯
      • 业务组件

    • 示例

    • 常见问题

    目录

    文字提示

    # FxTooltip 文字提示

    常用于展示鼠标 hover 时的提示信息。

    # Attributes

    参数 说明 类型 可选值 默认值
    effect 默认提供的主题 String dark/light dark
    content 显示的内容,也可以通过 slot#content 传入 DOM String — —
    placement Tooltip 的出现位置 String top/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end bottom
    value / v-model 状态是否可见 Boolean — false
    disabled Tooltip 是否可用 Boolean — false
    offset 出现位置的偏移量 Number — 0
    transition 定义渐变动画 String — el-fade-in-linear
    visible-arrow 是否显示 Tooltip 箭头,更多参数可见Vue-popper (opens new window) Boolean — true
    popper-options popper.js (opens new window) 的参数 Object 参考 popper.js (opens new window) 文档 { boundariesElement: 'body', gpuAcceleration: false }
    open-delay 延迟出现,单位毫秒 Number — 0
    manual 手动控制模式,设置为 true 后,mouseenter 和 mouseleave 事件将不会生效 Boolean — false
    popper-class 为 Tooltip 的 popper 添加类名 String — —
    enterable 鼠标是否可进入到 tooltip 中 Boolean — true
    hide-after Tooltip 出现后自动隐藏延时,单位毫秒,为 0 则不会自动隐藏 number — 0
    tabindex Tooltip 组件的 tabindex (opens new window) number — 0

    # 基础用法

    在这里我们提供 9 种不同方向的展示方式,可以通过以下完整示例来理解,选择您要的效果。

    上左 上边 上右
    左上 左边 左下
    右上 右边 右下
    下左 下边 下右

    使用content属性来决定hover时的提示信息。由placement属性决定展示效果:placement属性值为:方向-对齐位置;四个方向:top、left、right、bottom;三种对齐位置:start, end,默认为空。如placement="left-end",则提示信息出现在目标元素的左侧,且提示信息的底部与目标元素的底部对齐。

    <div class="box">
      <div class="top">
        <fx-tooltip class="item" effect="dark" content="Top Left 提示文字" placement="top-start">
          <fx-button>上左</fx-button>
        </fx-tooltip>
        <fx-tooltip class="item" effect="dark" content="Top Center 提示文字" placement="top">
          <fx-button>上边</fx-button>
        </fx-tooltip>
        <fx-tooltip class="item" effect="dark" content="Top Right 提示文字" placement="top-end">
          <fx-button>上右</fx-button>
        </fx-tooltip>
      </div>
      <div class="left">
        <fx-tooltip class="item" effect="dark" content="Left Top 提示文字" placement="left-start">
          <fx-button>左上</fx-button>
        </fx-tooltip>
        <fx-tooltip class="item" effect="dark" content="Left Center 提示文字" placement="left">
          <fx-button>左边</fx-button>
        </fx-tooltip>
        <fx-tooltip class="item" effect="dark" content="Left Bottom 提示文字" placement="left-end">
          <fx-button>左下</fx-button>
        </fx-tooltip>
      </div>
    
      <div class="right">
        <fx-tooltip class="item" effect="dark" content="Right Top 提示文字" placement="right-start">
          <fx-button>右上</fx-button>
        </fx-tooltip>
        <fx-tooltip class="item" effect="dark" content="Right Center 提示文字" placement="right">
          <fx-button>右边</fx-button>
        </fx-tooltip>
        <fx-tooltip class="item" effect="dark" content="Right Bottom 提示文字" placement="right-end">
          <fx-button>右下</fx-button>
        </fx-tooltip>
      </div>
      <div class="bottom">
        <fx-tooltip class="item" effect="dark" content="Bottom Left 提示文字" placement="bottom-start">
          <fx-button>下左</fx-button>
        </fx-tooltip>
        <fx-tooltip class="item" effect="dark" content="Bottom Center 提示文字" placement="bottom">
          <fx-button>下边</fx-button>
        </fx-tooltip>
        <fx-tooltip class="item" effect="dark" content="Bottom Right 提示文字" placement="bottom-end">
          <fx-button>下右</fx-button>
        </fx-tooltip>
      </div>
    </div>
    
    <style>
      .box {
        width: 400px;
    
        .top {
          text-align: center;
        }
    
        .left {
          float: left;
          width: 60px;
        }
    
        .right {
          float: right;
          width: 60px;
        }
    
        .bottom {
          clear: both;
          text-align: center;
        }
    
        .item {
          margin: 4px;
        }
    
        .left .el-tooltip__popper,
        .right .el-tooltip__popper {
          padding: 8px 10px;
        }
      }
    </style>
    
    显示代码 复制代码 复制代码

    # 主题

    Tooltip 组件提供了两个不同的主题:dark和light。

    Dark Light

    通过设置effect属性来改变主题,默认为dark。

    <fx-tooltip content="Top center" placement="top">
      <fx-button>Dark</fx-button>
    </fx-tooltip>
    <fx-tooltip content="Bottom centerBottom centerBottom centerBottom centerBottom centerBottom centerBottom centerBottom centerBottom centerBottom centerBottom centerBottom center" placement="left" effect="light">
      <fx-button>Light</fx-button>
    </fx-tooltip>
    
    
    显示代码 复制代码 复制代码

    # 更多 Content

    展示多行文本或者是设置文本内容的格式

    多行信息
    第二行信息
    Top center

    用具名 slot 分发content,替代tooltip中的content属性。

    <fx-tooltip placement="top">
      <div slot="content">多行信息<br/>第二行信息</div>
      <fx-button>Top center</fx-button>
    </fx-tooltip>
    
    显示代码 复制代码 复制代码

    # 高级扩展

    除了这些基本设置外,还有一些属性可以让使用者更好的定制自己的效果:

    transition 属性可以定制显隐的动画效果,默认为fade-in-linear。 如果需要关闭 tooltip 功能,disabled 属性可以满足这个需求,它接受一个Boolean,设置为true即可。

    事实上,这是基于 Vue-popper (opens new window) 的扩展,您可以自定义任意 Vue-popper 中允许定义的字段。 当然 Tooltip 组件实际上十分强大,文末的API文档会做一一说明。

    点击关闭 tooltip 功能
    <template>
      <fx-tooltip :disabled="disabled" content="点击关闭 tooltip 功能" placement="bottom" effect="light">
        <fx-button @click="disabled = !disabled">点击{{disabled ? '开启' : '关闭'}} tooltip 功能</fx-button>
      </fx-tooltip>
    </template>
    <script>
      export default {
        data() {
          return {
            disabled: false
          };
        }
      };
    </script>
    
    显示代码 复制代码 复制代码

    :::tip tooltip 内不支持 router-link 组件,请使用 vm.$router.push 代替。

    tooltip 内不支持 disabled form 元素,参考MDN (opens new window),请在 disabled form 元素外层添加一层包裹元素。 :::

    日历
    弹出框

    ← 日历 弹出框→

    • 跟随系统
    • 浅色模式
    • 深色模式
    • 阅读模式