CodeCoupler Application Basics PWA Handling Vue 🔒
What is this?
This Vue component uses @codecoupler-pro/app-pwa to display an icon as soon as the browser detects a PWA and offers to install it. Depending on whether a desktop or mobile browser is detected, the appropriate icon is displayed.
Setup
Install Bundle:
Define Aliases, Externals and Assets:
Basic Usage
Use it with JavaScript:
Use it as a CodeCoupler Costa Component:
Use it as Vue component:
Icons
All standard icons are defined as SVG. They have no background, width and height are set to
1em and all shapes use the current text color (fill or stroke attributes are set to
"currentColor"). For custom SVG icons, it is recommended that you follow this principle as well.
You can override the default icons using the property iconsComponent. Create a Vue file with
multiple svg icons and tag them with v-if like shown below. Place them all in one span element.
Define then one prop icon:
| icons-component-custom.vue | |
|---|---|
Import this file and use this as prop:
The following identifiers can be used:
- mobile
- desktop
Styling
CSS Classes
The internal HTML structure can be accessed as follows:
You can select a specific icon by adding the identifier: "& span.icon.identifier {}". Possible identifiers can be found in the above section.
Reference
The following props can be passed:
pwa: Object-
PWA module instance.
iconsComponent: Vue-
Overrides the default icons. See above.
showIconMobile: booleanandshowIconDesktop: boolean-
Handling the installation prompt works only in chromium based browsers. To show the icons in other bowsers (without any additional functionality) you can set these props to
true. showIcons: Object-
To show the icons regardless of the current status you can pass the identifier as properties and the value
trueto this object. Example:{ identifier1: true }.