### Complete Vue Floating Action Button Component Example Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md A comprehensive example demonstrating how to use vue-fab within a Vue component, including template structure, data binding for menu items, and event handling for item clicks. ```vue ``` -------------------------------- ### Install Vue Floating Action Button Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md Instructions for adding the vue-float-action-button package to your project using Yarn or npm. ```bash $ yarn add vue-float-action-button $ npm install vue-float-action-button ``` -------------------------------- ### Complete VueFab example component with dynamic items Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/homepage/index.html A full Vue component example demonstrating dynamic `fab-item` rendering using `v-for`, custom colors, and handling click events. It showcases a common pattern for populating FAB items from a data array and reacting to user interactions. ```Vue ``` -------------------------------- ### Install vue-float-action-button via Yarn or npm Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/homepage/index.html Instructions to add the `vue-float-action-button` package to your project using either Yarn or npm. ```Shell $ yarn add vue-float-action-button $ npm install vue-float-action-button ``` -------------------------------- ### Basic Integration and Data Setup for Vue-FAB Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/unfoldDirection.md Illustrates the fundamental usage of the Vue-FAB component within a Vue template, along with its corresponding script section to define initial data properties for controlling the component's behavior, such as unfold direction and animation models. ```Vue ``` ```JavaScript export default { data () { return { unfoldDirectionType: "down", fabAutoHideAnimateModel: "default", fabItemAnimate: "default" } } } ``` -------------------------------- ### Initialize Google Analytics and AdSense Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/index.html This JavaScript snippet initializes Google Analytics for tracking user behavior and Google AdSense for displaying advertisements on the web page. It configures the GA tracking ID and enables page-level ads for AdSense. ```javascript window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-145663310-2'); (adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-6177820902567416", enable_page_level_ads: true }); ``` -------------------------------- ### Apply Basic HTML and Body Styling Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/index.html This CSS snippet defines basic styles for the HTML and body elements, setting minimum height, background color, and a custom cursor for elements with the 'setCursor' class. ```css html { min-height: 100%; } body { background: #F4F4F4; height: 130vh; } .setCursor { cursor: pointer; } ``` -------------------------------- ### Vue-Fab Plugin Options API Reference Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md Details the configuration options available when registering the VueFab plugin, specifically the `iconType` property for choosing between Material Design and Iconfont icons. ```APIDOC options: iconType: Type: String Params: 'MaterialDesign'/'iconfont' Description: Decide which icon to use based on your usage habits or development dependencies Example Usage: Vue.use(VueFab, /* { ---------------------- // opitons Optional iconfont icon or MaterialIcons iconType: 'MaterialDesign' // iconType: 'iconfont' } */) ``` -------------------------------- ### Register Vue Floating Action Button Globally Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md Demonstrates how to import and register the VueFab plugin globally in your Vue application, allowing its components to be used throughout the project. ```javascript import App from './App.vue' import VueFab from 'vue-float-action-button' import Vue from 'vue' Vue.use(VueFab, /* { ---------------------- // opitons Optional Alibaba iconfont icon or MaterialIcons iconType: 'MaterialDesign' // iconType: 'iconfont' } */) new Vue({ render: h => h(App) }).$mount('#app') ``` -------------------------------- ### Integrate Alibaba Iconfont with Vue FAB Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md Illustrates how to use Alibaba Iconfont icons with the vue-fab component, assuming the iconfont stylesheet has been imported as per Iconfont's instructions. ```vue ``` -------------------------------- ### Integrate Google Analytics and AdSense Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/demo/index.html This JavaScript snippet initializes Google Analytics for tracking page views and integrates Google AdSense for displaying advertisements. It sets up the dataLayer and pushes configuration for both services, enabling analytics and ads on the webpage. ```javascript window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-145663310-2'); (adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-6177820902567416", enable_page_level_ads: true }); ``` -------------------------------- ### Basic HTML and Body Styling Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/demo/index.html This CSS snippet provides basic styling for the HTML and body elements, setting minimum height, background color, and a custom cursor for a specific class. It ensures the page takes up at least the full viewport height and applies a light grey background. ```css html { min-height: 100%; } body { background: #F4F4F4; height: 130vh; } .setCursor { cursor: pointer; } ``` -------------------------------- ### Initialize Vue-Fab Plugin with Icon Type Configuration Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/homepage/iconfont.html This snippet illustrates how to register the Vue-Fab plugin globally using `Vue.use()`. It specifically demonstrates configuring the `iconType` option during initialization, which dictates whether the component should use 'MaterialDesign' or 'iconfont' for its icons, providing flexibility in icon library choice. ```JavaScript Vue.use(VueFab, /* { ---------------------- // opitons 可选iconfont图标或MaterialIcons iconType: 'MaterialDesign' // iconType: 'iconfont' } */) ``` -------------------------------- ### Vue Floating Action Button Component Methods API Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md Describes the methods available for programmatic control of the main Vue Floating Action Button component. ```APIDOC onOffFab (Param: True / False, Type: Boolean, Default: True): Show or hide Fab ``` -------------------------------- ### Vue Floating Action Button Safari Compatibility Note Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md Provides important information regarding event handling differences in Safari browser for the Floating Action Button component, including potential workarounds. ```APIDOC Due to Safari's event delivery mechanism, window, document, and body do not respond to click events. If clicks on a blank area and the submenu cannot be automatically closed, please check if the HTML height is 100%. If it is not 100%, set the CSS attribute 'min-height: 100%' to the HTML tag separately. The project handles the Safari browser separately: in Safari, the click event is mounted on the HTML tag, while in other browsers (non-iOS systems), it is mounted on the window. ``` -------------------------------- ### Implement VueFab with Alibaba Iconfont Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/homepage/index.html Illustrates how to use `vue-float-action-button` with icons from Alibaba Iconfont.cn. The component handles the icon type internally, requiring only the icon class name (e.g., 'icon-jia') to be passed to the `icon` property. ```HTML ``` -------------------------------- ### Implement VueFab with Material Design Icons Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/homepage/index.html Shows how to integrate `vue-float-action-button` using Material Design icons. This requires linking the Material Icons stylesheet in `index.html` and then using `fab-item` components with icon names like 'add' or 'edit'. ```HTML // index.html // App.vue ``` -------------------------------- ### Vue Floating Action Button Item (fab-item) Component Events API Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md Outlines the events emitted by individual Floating Action Button menu items, allowing for interaction handling. ```APIDOC clickItem (Param: {idx}): When the menu item is not empty and the menu item is clicked, the idx value passed in the menu item is returned. ``` -------------------------------- ### Vue Floating Action Button Component Props API Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md Documents the configurable properties for the main Vue Floating Action Button component, controlling its appearance, behavior, and animations. ```APIDOC iconType (String, 'MaterialDesign', 'MaterialDesign'/'iconfont'): Decide which icon to use based on your usage habits or development dependencies autoHideDirection (String, 'up', 'up' / 'down'): Rolling auto-hiding direction control, default value up to show up to hide down value to show up to hide down value unfoldDirection (String, 'up', 'up' / 'down'): Expanding direction, up or down icon (String, 'add', /): Inactive icon activeIcon (String, 'add', /): Activated icon size (String, 'Normal', 'big' / 'normal' / 'small'): The size of the main Fab will change with the submenu. mainBtnColor (String, '#E64C3B', /): Main button color hidden (Boolean, true, true / false): Whether to hide Fab fabAnimateBezier (String, linear, 'ease' / 'linear' / 'ease-in' / 'ease-out' / 'ease-in-out' / '.18,.89,.91,.17'): The main button shows the hidden Bezier curve. Fill in the Bezier curve and fill in 'n, n, n, n' or 'liner' directly. z-index (Number, 5, /): Fab level shadow (Boolean, true, true / false): Main button shadow clickAutoClose (Boolean, true, true / false): Whether to close the menu after clicking the submenu item scrollAutoHide (Boolean, true, true / false): Whether scrolling triggers auto-hiding (the PC side and the mobile side are implemented differently according to the scroll event and the touchmove event respectively) autoHideThreshold (Number, 10, /): Scroll triggered auto-hidden threshold unit px fabAutoHideAnimateModel (String, 'alive', 'default' / 'alive'): Fab scrolling triggers auto-hide animations into 'default' (reduce hidden) and 'alive' (scroll down) fabItemAnimate (String, 'default', 'default' / 'alive'): Transition animation when opening the close submenu is divided into 'default' (respectively) 'alive' (split transition) fabAliveAnimateBezier (String, '.16,1.01,.61,1.2', 'ease' / 'linear' / 'ease-in' / 'ease-out' / 'ease-in-out' / '.18,.89,.91,.17'): Sub-menu list Bezier curve in alive animation mode Note: Only when fabMenuAnimate is alive globalOptions (Object, {spacing: 40, delay: 0.05}, /): Animation delay and spacing for each fab-item delay: The delay difference between the fade in and out of the menu item is the delay (in s) of the delay for the previous menu item (the value is automatically divided by 3 when the fabItemAnimate is alive) spacing: Spacing of each menu item Unit px ``` -------------------------------- ### Integrate Material Design Icons with Vue FAB Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md Shows how to include the Material Icons stylesheet in your HTML and use Material Design icons within the vue-fab component by specifying icon names. ```html ``` ```vue ``` -------------------------------- ### Vue-Fab Plugin `iconType` Option API Documentation Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/homepage/iconfont.html This API documentation details the `iconType` configuration option available for the Vue-Fab plugin. It specifies the accepted string values ('MaterialDesign' or 'iconfont') and clarifies its role in selecting the appropriate icon library for the floating action button component. ```APIDOC Option: iconType Type: String Params: 'MaterialDesign'/'iconfont' Description: Determines which icon library to use based on development habits or dependencies. ``` -------------------------------- ### API Reference: unfoldDirection Property Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/unfoldDirection.md Provides detailed API documentation for the `unfoldDirection` property of the Vue-FAB component, specifying its data type, default value, accepted parameters, and a description of its functionality. ```APIDOC unfoldDirection: Type: String Default: 'up' Params: 'down' / 'up' Description: Controls whether the FAB expands upwards or downwards. ``` -------------------------------- ### Globally register VueFab component in Vue application Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/homepage/index.html Demonstrates how to import and globally register the `vue-float-action-button` plugin in your Vue application, with optional configuration for icon type (Material Design or Iconfont). ```JavaScript 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') ``` -------------------------------- ### Vue Floating Action Button Item (fab-item) Component Props API Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/readme.en.md Details the properties for individual items within the Floating Action Button menu, affecting their display and behavior. ```APIDOC idx (Number, 0, /): The subscript determines the position and the value returned by the clickItem event (required) title (String, '', /): Menu item title If not filled, the title box will not be displayed. icon (String, 'add', /): Submenu item icon Supports [Material Icon] (https://material.io/icons/) and [iconfont](https://www.iconfont.cn/) icon color (String, '#FFF', /): Support for css color standard Default to white Do not fill in this value will automatically have a shadow with a value of 0px 2px 8px #666 titleColor (String, #666, /): Submenu title font color titleBgColor (String, #FFF, /): Submenu background color ``` -------------------------------- ### Vue Component Data and Methods for Dynamic Icon Source Management Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/homepage/iconfont.html This Vue component script defines reactive data properties to manage the active icon source, allowing dynamic switching between 'iconfont' and 'MaterialDesign'. It also includes a method, `handleSource`, to toggle the `currentSource` state, which can be used to update the displayed icons. ```JavaScript export default { data () { return { currentSource: 'iconfont', mainIcon: { iconfont: 'icon-jia', MaterialDesign: 'add' }, menu: { MaterialDesign: [ { icon: 'done', title: 'good job!', color: '#ff9900' }, { icon: 'toc', title: '', color: '#999' } ], iconfont: [ { icon: 'icon-Rxing', title: 'iconfont.cn', color: '#483218' }, { icon: 'icon-huanyihuan1', title: '', color: '#c8d' }, { icon: 'icon-fangda1', title: '', color: '#3DB' } ] } } }, methods: { handleSource () { this.currentSource === 'iconfont' ? this.currentSource = 'MaterialDesign' : this.currentSource = 'iconfont' } } } ``` -------------------------------- ### Dynamically Toggling Vue-FAB Unfold Direction Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/unfoldDirection.md Demonstrates how to programmatically switch the `unfoldDirection` of the Vue-FAB component between 'up' and 'down' using a button click, showcasing interactive control over the component's display. ```Vue ``` -------------------------------- ### VueFab unfoldDirection API Reference Source: https://github.com/a62527776a/vue-floating-action-button/blob/master/docs/homepage/homepage/unfoldDirection.html Details the 'unfoldDirection' option for the VueFab component, controlling whether the floating action button expands upwards or downwards. ```APIDOC Option: unfoldDirection Type: String Default: 'up' Params: 'down' / 'up' Description: Expands upwards or downwards ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.