Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Latest commit

 

History

History
68 lines (47 loc) · 3.11 KB

the-prototype-variable.md

File metadata and controls

68 lines (47 loc) · 3.11 KB

The prototype variable

After you installed simpli-web-sdk, you may use the $. This is a constant which has the main prototypes variables of Vue components. Therefore, you have the access of theses variables from a non-vue-component file.

Take a look of its content:

Variable Alias inside a Vue component Details
$.axios this.$axios access of axios instance
$.socket this.$socket access of socket instance
$.components - gets global Vue components
$.filters - gets global Vue filters
$.bus this.$bus custom bus event generated after you run Simpli.install()
$.router this.$router gets the router variable from vue-router module
$.route this.$route gets the route variable from vue-router module
$.i18n this.$i18n gets the i18n variable from vue-i18n module
$.t this.$t gets the t variable from vue-i18n module
$.tc this.$tc gets the tc variable from vue-i18n module
$.te this.$te gets the te variable from vue-i18n module
$.d this.$d gets the d variable from vue-i18n module
$.n this.$n gets the n variable from vue-i18n module
$.snotify this.$snotify gets the variable from vue-snotify module
$.ajv this.$ajv gets the ajv variable from ajv module
$.await this.$await the controller of Await Component
$.modal this.$modal the controller of Modal Component
$.tip this.$tip the controller of Tip Component

Examples of usage

import {$} from 'simpli-web-sdk'
import {schema, data} from '@/ajv/mySchema'

$.axios.get('path/to/url') // request from the native axios

$.socket.connect('notification', 'path/to/url') // socket connection

$.component.MyComponent // access your global component

$.filter.truncate('foobar', 3) // it returns 'foo...'

$.router.push('/login') // go to login page

$.i18n.messages // get locale messages structure

$.bus.myCustomAction() // custom action you have provided

$.route.query // get the query params of current page

$.t('path.to.locale') // translate a text

$.snotify.success('Success message') // emit a success message

$.ajv.validate(schema, data) // validate a data from a schema

$.await.init('awaitName') // start loading some content

$.modal.open('modalName') // open a modal by his name

$.tip.show('tipName') // show a tip by his name

Each of individual variables have more details in Docs

Next Topic

Socket Connections