How to use the vue.prototype function in vue

To help you get started, we’ve selected a few vue examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DivanteLtd / vue-storefront / core / store / modules / sync / mutations.ts View on Github external
[types.SYNC_ADD_TASK] (state, task) {
    const tasksCollection = Vue.prototype.$db.syncTaskCollection
    task = _prepareTask(task)
    tasksCollection.setItem(task.task_id.toString(), task, (err, resp) => {
      if (err) console.error(err)
      Vue.prototype.$bus.$emit('sync/PROCESS_QUEUE', { config: rootStore.state.config }) // process checkout queue
      Logger.info('Request added to sync queue: '+ task.url, { tag: 'sync', context: { label: 'Task ID', value: task.task_ud }})
    }).catch((reason) => {
      console.error(reason) // it doesn't work on SSR
    })
  }
}
github long-woo / 12306-electron / src / renderer / main.js View on Github external
import 'nprogress/nprogress.css'
import nprogress from 'nprogress'

import 'animate.css/animate.css'

import bsComponents from './components'

import api from './api'

if (!process.env.IS_WEB) Vue.use(require('vue-electron'))

Vue.config.productionTip = false

Wavas.init()

Vue.swal = Vue.prototype.$swal = swal
Vue.nprogress = Vue.prototype.$nprogress = nprogress
Vue.api = Vue.prototype.$api = api
Vue.store = store

Vue.use(BootstrapVue)
Vue.use(bsComponents)

/* eslint-disable no-new */
const vue = new Vue({
  components: { App },
  router,
  store,
  template: ''
}).$mount('#app')

Vue.eventBus = Vue.prototype.$eventBus = vue
github leoDreamer / letchat-server / resource / pages / chat / index.js View on Github external
import VueAxios from "vue-axios";
import axios from "assets/axios";
import "root/node_modules/iview/dist/styles/iview.css";

// vuex
Vue.use(Vuex);
Vue.use(VueAxios, axios);

// 按需引入iview组件
import { Button, Form, Input, Icon, Message } from "iview";
Vue.component("Form", Form);
Vue.component("FormItem", Form.Item);
Vue.component("Input", Input);
Vue.component("Button", Button);
Vue.component("Icon", Icon);
Vue.prototype.$Message = Message;
window.$Message = Message;

// init vuex
const store = new Vuex.Store(stores);
Vue.config.debug = true;

// init vue
new Vue({
    el: "#app",
    template: "",
    components: { App },
    store
});
github gaia-pipeline / gaia / frontend / src / main.js View on Github external
const NotificationComponent = Vue.extend(Notification)
const openNotification = (propsData = {
  title: '',
  message: '',
  type: '',
  direction: '',
  duration: 4500,
  container: '.notifications'
}) => {
  return new NotificationComponent({
    el: document.createElement('div'),
    propsData
  })
}
Vue.prototype.$notify = openNotification

function handleError (error) {
  // if the server gave a response message, print that
  if (error.response) {
    // duration should be proportional to the error message length
    openNotification({
      title: 'Error: ' + error.response.status,
      message: error.response.data,
      type: 'danger'
    })
  } else if (error.request) {
    openNotification({
      title: 'Error: No response received!',
      message: 'Please verify if the backend is running!',
      type: 'danger'
    })
github anodyne / nova3 / nova / resources / js / vue-global.js View on Github external
import Vue from 'vue';

Vue.config.productionTip = false;

/* eslint-disable */
Vue.prototype.$route = window.route;
Vue.prototype.$events = new Vue();
/* eslint-enable */
github qianbin01 / lagou_vue / src / main.js View on Github external
import 'swiper/dist/css/swiper.css';
import VueLazyload from 'vue-lazyload'

Vue.component(DatetimePicker.name, DatetimePicker);
Vue.component(Switch.name, Switch);
if (config.MOCK_ENABLE) {
  require('./data');//加载mock
}
require('./style/my-mint.scss');
Vue.use(Mint);
Vue.config.productionTip = false;
Vue.prototype.BaseApi = BaseApi;//将BaseApi挂载在Vue中
Vue.prototype.commonUtils = commonUtils;//将commonUtils挂载在Vue中
Vue.prototype.$config = config;//将config挂载在Vue中
Vue.prototype.$messageBox = MessageBox;//弹窗挂载
Vue.prototype.$toast = Toast;//Toast挂载
Vue.use(VueLazyload);

new Vue({
  el: '#app',
  router,
  store,
  components: {App},
  template: ''
});
github hunzhiwange / queryphp / frontend / src / utils / clipboard.js View on Github external
function clipboardSuccess() {
    Vue.prototype.$message({
        message: '复制成功',
        type: 'success',
        duration: 1500,
    })
}
github Lab41 / freqgen / packages / freqgen-ui / src / main.js View on Github external
import '@babel/polyfill'
import 'mutationobserver-shim'
import Vue from 'vue'
import './plugins/bootstrap-vue'
import App from './App.vue'
import store from './store'

Vue.config.productionTip = false

new Vue({
  store,
  render: h => h(App),
}).$mount('#app')

const freqgen = require('../../freqgen-core')
Object.defineProperty(Vue.prototype, '$freqgen', { value: freqgen })
github oktadeveloper / okta-vuejs-aspnetcore-todo-example / ClientApp / app.js View on Github external
import Vue from 'vue'
import axios from 'axios'
import router from './router'
import store from './store'
import { sync } from 'vuex-router-sync'
import App from 'components/app-root'

Vue.prototype.$http = axios;

sync(store, router)

const app = new Vue({
    store,
    router,
    ...App
})

export {
    app,
    router,
    store
}