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

  • 组件

    • 组件总览
    • UI组件

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

    • 示例

    • 常见问题

    目录

    弹出框

    # FxPopover 弹出框

    # Attributes

    参数 说明 类型 可选值 默认值
    trigger 触发方式 String click/focus/hover/manual click
    title 标题 String — —
    content 显示的内容,也可以通过 slot 传入 DOM String — —
    width 宽度 String, Number — 最小宽度 150px
    placement 出现位置 String top/top-start/top-end/bottom/bottom-start/bottom-end/left/left-start/left-end/right/right-start/right-end bottom
    disabled Popover 是否可用 Boolean — false
    value / v-model 状态是否可见 Boolean — false
    offset 出现位置的偏移量 Number — 0
    transition 定义渐变动画 String — 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 }
    popper-class 为 popper 添加类名 String — —
    open-delay 触发方式为 hover 时的显示延迟,单位为毫秒 Number — —
    close-delay 触发方式为 hover 时的隐藏延迟,单位为毫秒 number — 200
    tabindex Popover 组件的 tabindex (opens new window) number — 0

    # Slot

    参数 说明
    — Popover 内嵌 HTML 文本
    reference 触发 Popover 显示的 HTML 元素

    # Events

    事件名称 说明 回调参数
    show 显示时触发 —
    after-enter 显示动画播放完毕后触发 —
    hide 隐藏时触发 —
    after-leave 隐藏动画播放完毕后触发 —

    # 基础用法

    Popover 的属性与 Tooltip 很类似,它们都是基于Vue-popper开发的,因此对于重复属性,请参考 Tooltip 的文档,在此文档中不做详尽解释。

    hover 激活 click 激活 focus 激活 手动激活

    trigger属性用于设置何时触发 Popover,支持四种触发方式:hover,click,focus 和 manual。对于触发 Popover 的元素,有两种写法:使用 slot="reference" 的具名插槽,或使用自定义指令v-popover指向 Popover 的索引ref。

    <template>
      <fx-popover
        placement="top-start"
        title="标题"
        width="200"
        trigger="hover"
        content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
        <fx-button slot="reference">hover 激活</fx-button>
      </fx-popover>
    
      <fx-popover
        placement="bottom"
        title="标题"
        width="200"
        trigger="click"
        content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
        <fx-button slot="reference">click 激活</fx-button>
      </fx-popover>
    
      <fx-popover
        ref="popover"
        placement="right"
        title="标题"
        width="200"
        trigger="focus"
        content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。">
      </fx-popover>
      <fx-button v-popover:popover>focus 激活</fx-button>
    
      <fx-popover
        placement="bottom"
        title="标题"
        width="200"
        trigger="manual"
        content="这是一段内容,这是一段内容,这是一段内容,这是一段内容。"
        v-model="visible">
        <fx-button slot="reference" @click="visible = !visible">手动激活</fx-button>
      </fx-popover>
    </template>
    
    <script>
      export default {
        data() {
          return {
            visible: false
          };
        }
      };
    </script>
    
    显示代码 复制代码 复制代码

    # 嵌套信息

    可以在 Popover 中嵌套多种类型信息,以下为嵌套表格的例子。

    click 激活

    利用分发取代content属性

    <fx-popover
      placement="right"
      width="400"
      trigger="click">
      <fx-table :data="gridData">
        <fx-table-column width="150" property="date" label="日期"></fx-table-column>
        <fx-table-column width="100" property="name" label="姓名"></fx-table-column>
        <fx-table-column width="300" property="address" label="地址"></fx-table-column>
      </fx-table>
      <fx-button slot="reference">click 激活</fx-button>
    </fx-popover>
    
    <script>
      export default {
        data() {
          return {
            gridData: [{
              date: '2016-05-02',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1518 弄'
            }, {
              date: '2016-05-04',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1518 弄'
            }, {
              date: '2016-05-01',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1518 弄'
            }, {
              date: '2016-05-03',
              name: '王小虎',
              address: '上海市普陀区金沙江路 1518 弄'
            }]
          };
        }
      };
    </script>
    
    显示代码 复制代码 复制代码

    # 嵌套操作

    当然,你还可以嵌套操作,这相比 Dialog 更为轻量:

    这是一段内容这是一段内容确定删除吗?
    确定 取消
    删除
    <fx-popover
      placement="top"
      v-model="visible">
      <div>这是一段内容这是一段内容确定删除吗?</div>
      <div class="actions">
        <fx-button type="primary" size="mini" @click="visible = false">确定</fx-button>
        <fx-button size="mini" type="text" @click="visible = false">取消</fx-button>
      </div>
      <fx-button slot="reference">删除</fx-button>
    </fx-popover>
    
    <script>
      export default {
        data() {
          return {
            visible: false,
          };
        }
      }
    </script>
    
    显示代码 复制代码 复制代码
    文字提示
    折叠面板

    ← 文字提示 折叠面板→

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