
Product
A Fresh Look for the Socket Dashboard
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
vue-float-action-button
Advanced tools
$ yarn add vue-float-action-button
$ npm install vue-float-action-button
import App from './App.vue'
import VueFab from 'vue-float-action-button'
import Vue from 'vue'
Vue.use(VueFab, /* {
----------------------
// opitons 可选iconfont图标或MaterialIcons
iconType: 'MaterialDesign'
// iconType: 'iconfont'
} */)
new Vue({
render: h => h(App)
}).$mount('#app')
本组件支持两种图标 一种为 Material Design 的图标 需要在网页中引入
// index.html
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
// App.vue
<vue-fab mainBtnColor="#3599DB">
<fab-item @clickItem="clickItem" :idx="0" title="add" icon="add" />
<fab-item @clickItem="clickItem" :idx="1" title="https" icon="https" />
<fab-item @clickItem="clickItem" :idx="2" title="edit" icon="edit" />
</vue-fab>
所有ICON皆可从 https://material.io/icons/ 中查找
如使用阿里巴巴矢量图标库 https://www.iconfont.cn 则按提示引入
<vue-fab icon="icon-jia"
fabItemAnimate="default"
mainBtnColor="#16C2C2">
<fab-item @clickItem="clickBABA" icon="icon-Rxing" :idx="0" title="iconfont.cn">
</fab-item>
<fab-item @clickItem="clickBABA" icon="icon-huanyihuan1" :idx="1" title="交换">
</fab-item>
<fab-item @clickItem="clickBABA" icon="icon-fangda1" :idx="2" title="聚焦">
</fab-item>
</vue-fab>
<template>
<vue-fab
:mainBtnColor="mainBtnColor">
<fab-item
v-for="(item, idx) in menu"
:idx="idx"
:title="item.title"
:color="item.color"
:icon="item.icon"
@clickItem="clickItem" />
</vue-fab>
</template>
<script>
export default {
name: 'example',
data () {
return {
menu: [
{
icon: 'done',
title: 'good job!',
color: '#ff9900'
},
{
icon: 'toc',
title: '',
color: '#999'
}
],
mainBtnColor: '#3eaf7c'
}
},
methods: {
clickItem: function (item) {
window.alert(item.idx)
}
}
}
</script>
Option | Type | Params | Description |
---|---|---|---|
iconType | String | 'MaterialDesign'/'iconfont' | 根据您的使用习惯或开发依赖来决定使用哪种图标 |
Vue.use(VueFab, /* {
----------------------
// opitons 可选iconfont图标或MaterialIcons
iconType: 'MaterialDesign'
// iconType: 'iconfont'
} */)
vue-fab API
Option | Type | Default | Params | Description |
---|---|---|---|---|
iconType | String | 'MaterialDesign' | 'MaterialDesign'/'iconfont' | 根据您的使用习惯或开发依赖来决定使用哪种图标 |
autoHideDirection | String | 'up' | 'up' / 'down' | 滚动自动隐藏的方向控制,默认值up为向下展示向上隐藏down值为向上展示向下隐藏 |
unfoldDirection | String | 'up' | 'up' / 'down' | 展开方向,向上或者向下 |
icon | String | 'add' | / | 未激活的icon |
activeIcon | String | 'add' | / | 激活后的icon |
size | String | 'Normal' | 'big' / 'normal' / 'small' | 主Fab的尺寸 子菜单会随之变化 |
mainBtnColor | String | '#E64C3B' | / | 主按钮颜色 |
hidden | Boolean | true | true / false | 是否隐藏Fab |
fabAnimateBezier | String | linear | 'ease' / 'linear' / 'ease-in' / 'ease-out' / 'ease-in-out' / '.18,.89,.91,.17' | 主按钮显示消失(hidden)的贝塞尔曲线 如填入贝塞尔曲线 直接填入'n,n,n,n'或'liner' |
z-index | Number | 5 | / | fab的层级 |
shadow | Boolean | true | true / false | 主button的阴影 |
clickAutoClose | Boolean | true | true / false | 点击子菜单项后是否关闭菜单 |
scrollAutoHide | Boolean | true | true / false | 滚动是否触发自动隐藏 (PC端和Mobile端实现方式有所不同 分别根据scroll事件和touchmove事件实现) |
autoHideThreshold | Number | 10 | / | 滚动触发自动隐藏的阈值 单位px |
fabAutoHideAnimateModel | String | 'alive' | 'default' / 'alive' | fab滚动触发自动隐藏动画 分为 'default' ( 缩小隐藏 ) 以及 'alive' (向下滚动隐藏) |
fabItemAnimate | String | 'default' | 'default' / 'alive' | 打开关闭子菜单时过渡动画 分为 'default' (各自过渡) 'alive' (分裂过渡) |
fabAliveAnimateBezier | String' | '.16,1.01,.61,1.2' | 'ease' / 'linear' / 'ease-in' / 'ease-out' / 'ease-in-out' / '.18,.89,.91,.17' | 子菜单列表在alive动画模式下的贝塞尔曲线 注:仅fabMenuAnimate为alive时生效 |
globalOptions | Object | {spacing: 40, delay: 0.05} | / | 每个fab-item的动画延迟和间距 |
Name | Param | Type | Default | Description |
---|---|---|---|---|
onOffFab | True / False | Boolean | True | 显示或者隐藏Fab |
fab-item API
Option | Type | Default | Params | Description |
---|---|---|---|---|
idx | Number | 0 | / | 下标 决定了位置以及clickItem事件返回的值(必须) |
title | String | '' | / | 菜单项标题 如果不填 将不显示title框 |
icon | String | 'add' | / | Submenu item icon Supports [Material Icon] (https://material.io/icons/) and iconfont icon |
color | String | '#FFF' | / | 支持css颜色标准 默认为白色 不填写该值将自动拥有一个值为0px 2px 8px #666的阴影 |
titleColor | String | #666 | / | 子菜单标题字体颜色 |
titleBgColor | String | #FFF | / | 子菜单背景颜色 |
Name | Param | Description |
---|---|---|
clickItem | {idx} | 当菜单项不为空且点击菜单项时,会返回该菜单项传入的idx值 |
MIT
FAQs
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
We’ve redesigned the Socket dashboard with simpler navigation, less visual clutter, and a cleaner UI that highlights what really matters.
Industry Insights
Terry O’Daniel, Head of Security at Amplitude, shares insights on building high-impact security teams, aligning with engineering, and why AI gives defenders a fighting chance.
Security News
MCP spec updated with structured tool output, stronger OAuth 2.1 security, resource indicators, and protocol cleanups for safer, more reliable AI workflows.