/*! For license information please see 128.61634dbd.js.LICENSE.txt */ (self.webpackChunk=self.webpackChunk||[]).push([["128"],{77979:function(s,n,a){"use strict";a.r(n);var t=a("80681");let e=["innerHTML"];n.default={setup:()=>({html:""}),render:()=>((0,t.wg)(),(0,t.iD)("div",{class:"van-doc-markdown-body",innerHTML:'
Clickable bubbles that hover around the edge of the page. Please upgrade vant to >= v4.6.0 before using this component.
Register component globally via app.use, refer to Component Registration for more registration ways.
import { createApp } from 'vue';\nimport { FloatingBubble } from 'vant';\n\nconst app = createApp();\napp.use(FloatingBubble);\n\nThe floating bubble is displayed by default in the bottom right corner and allows vertical dragging in the y-axis direction. You can set the icon of the bubble using the icon prop.
<van-floating-bubble icon="chat" @click="onClick" />\n\nimport { showToast } from 'vant';\n\nexport default {\n setup() {\n const onClick = () => {\n showToast('Click Bubble');\n };\n return { onClick };\n },\n};\n\nAllow x and y drags to attach to the nearest side of the x axis.
\n<van-floating-bubble\n axis="xy"\n icon="chat"\n magnetic="x"\n @offset-change="onOffsetChange"\n/>\n\nimport { showToast } from 'vant';\n\nexport default {\n setup() {\n const onOffsetChange = (offset) => {\n showToast(`x: ${offset.x.toFixed(0)}, y: ${offset.y.toFixed(0)}`);\n };\n return { onOffsetChange };\n },\n};\n\nUse v-model:offset control the position.
<van-floating-bubble v-model:offset="offset" axis="xy" icon="chat" />\n\nimport { ref } from 'vue';\n\nexport default {\n setup() {\n const offset = ref({ x: 200, y: 400 });\n return { offset };\n },\n};\n\n| Attribute | \nDescription | \nType | \nDefault | \n
|---|---|---|---|
| v-model:offset | \nControl bubble position | \nOffsetType | \nDefault right-bottom coordinate | \n
| axis | \nDrag direction, xy stands for free drag, lock stands for disable drag | \n\'x\' | \'y\' | \'xy\' | \'lock\' | \ny | \n
| magnetic | \nDirection of automatic magnetic absorption | \n\'x\' | \'y\' | \n- | \n
| icon | \nBubble icon | \nstring | \n- | \n
| gap | \nMinimum gap between the bubble and the window, unit px | \nnumber | \n24 | \n
| teleport | \nSpecifies a target element where BackTop will be mounted | \nstring | Element | \nbody | \n
| Event | \nDescription | \nArguments | \n
|---|---|---|
| click | \nTriggered when a component is clicked | \nMouseEvent | \n
| offset-change | \nTriggered when the position changes due to user dragging | \n{x: string, y: string} | \n
| Name | \nDescription | \n
|---|---|
| default | \nCustomize the bubble display content | \n
The component exports the following type definitions:
\nexport type {\n FloatingBubbleProps,\n FloatingBubbleAxis,\n FloatingBubbleMagnetic,\n FloatingBubbleOffset,\n} from 'vant';\n\nThe component provides the following CSS variables, which can be used to customize styles. Please refer to ConfigProvider component.
\n| Name | \nDefault Value | \nDescription | \n
|---|---|---|
| --van-floating-bubble-size | \n48px | \n- | \n
| --van-floating-bubble-initial-gap | \n24px | \n- | \n
| --van-floating-bubble-icon-size | \n28px | \n- | \n
| --van-floating-bubble-background | \nvar(--van-primary-color) | \n- | \n
| --van-floating-bubble-color | \nvar(--van-background-2) | \n- | \n
| --van-floating-bubble-z-index | \n999 | \n- | \n
| --van-floating-bubble-border-radius | \n--van-floating-bubble-border-radius | \n- | \n