How to use the vue.util 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 simplesmiler / vue-clickaway / dist / vue-clickaway.common.js View on Github external
'use strict';

var Vue = require('vue');
Vue = 'default' in Vue ? Vue['default'] : Vue;

var version = '2.2.2';

var compatible = (/^2\./).test(Vue.version);
if (!compatible) {
  Vue.util.warn('VueClickaway ' + version + ' only supports Vue 2.x, and does not support Vue ' + Vue.version);
}



// @SECTION: implementation

var HANDLER = '_vue_clickaway_handler';

function bind(el, binding, vnode) {
  unbind(el);

  var vm = vnode.context;

  var callback = binding.value;
  if (typeof callback !== 'function') {
    if (process.env.NODE_ENV !== 'production') {
github wangweianger / vue2.5-webpack3.8-spa-base-cms / src / main.js View on Github external
//设置title
router.beforeEach((to, from, next) => {
	$("#content").hide()
	document.title = to.meta.title || '启明星'
	window.scrollTo(0, 0)
	let zaneEle = $('div.zane-calendar');
	if(zaneEle.length) $('div.zane-calendar').parent().remove();
	next()
})
router.afterEach((to, from, next) => {
	$("#content").fadeIn()
})

Vue.config.productionTip = false
const app = new Vue(Vue.util.extend({
	router,
}, App))

// 从而让整个应用都有路由功能
app.$mount('#app')
github askmike / gekko / web / vue / src / components / gekko / new.vue View on Github external
startAt = moment().utc().startOf('minute').format();
      else {
        // TODO: figure out whether we can stitch data
        // without looking at the existing watcher
        const optimal = moment().utc().startOf('minute')
          .subtract(this.requiredHistoricalData, 'minutes')
          .unix();

        const available = moment
          .utc(this.existingMarketWatcher.events.initial.candle.start)
          .unix();

        startAt = moment.unix(Math.max(optimal, available)).utc().format();
      }

      const gekkoConfig = Vue.util.extend({
        market: {
          type: 'leech',
          from: startAt
        },
        mode: 'realtime'
      }, this.config);
      return gekkoConfig;
    },
    existingMarketWatcher: function() {
github simplesmiler / vue-focus / index.js View on Github external
import Vue from 'vue';

export var version = '2.1.0';

var compatible = (/^2\./).test(Vue.version);
if (!compatible) {
  Vue.util.warn('VueFocus ' + version + ' only supports Vue 2.x, and does not support Vue ' + Vue.version);
}

export var focus = {
  inserted: function(el, binding) {
    if (binding.value) el.focus();
    else el.blur();
  },

  componentUpdated: function(el, binding) {
    if (binding.modifiers.lazy) {
      if (Boolean(binding.value) === Boolean(binding.oldValue)) {
        return;
      }
    }

    if (binding.value) el.focus();
github youzan / vant / packages / locale / index.ts View on Github external
import Vue from 'vue';
import { deepAssign } from '../utils/deep-assign';
import defaultMessages from './lang/zh-CN';

declare module 'vue' {
  interface VueConstructor {
    util: {
      defineReactive(obj: object, key: string, value: any): void;
    };
  }
}

const proto = Vue.prototype;
const { defineReactive } = Vue.util;

defineReactive(proto, '$vantLang', 'zh-CN');
defineReactive(proto, '$vantMessages', {
  'zh-CN': defaultMessages
});

export default {
  messages() {
    return proto.$vantMessages[proto.$vantLang];
  },

  use(lang: string, messages?: object) {
    proto.$vantLang = lang;
    this.add({ [lang]: messages });
  },
github marcel-dancak / bass-app / vue / src / components / PianoBeat.vue View on Github external
sounds.forEach(sound => {
          Vue.util.defineReactive(sound, 'end')
        })
      }
github cevio / simplize / src / js / directives / href.js View on Github external
unbind: function(){
            Vue.util.off(this.el, 'click', this._cb);
        }
    }
github cevio / simplize / src / js / directives / url.js View on Github external
unbind: function(){
            Vue.util.off(this.el, 'click', this._cb);
        }
    }
github askmike / gekko / web / vue / src / store / modules / stratrunners / mutations.js View on Github external
export const updateStratrunner = (state, update) => {
  let index = state.stratrunners.findIndex(i => i.id === update.gekko_id);
  let item = state.stratrunners[index];
  if(!item)
    return state;

  let updated = Vue.util.extend(item, update.updates);
  Vue.set(state.stratrunners, index, updated);

  return state;
}
export const addTradeToStratrunner = (state, update) => {
github Akryum / blaze2 / packages / blaze2 / blaze2.js View on Github external
Vue.prototype.defineReactive = function(map) {
  for(const k in map) {
    Vue.util.defineReactive(this, k, map[k]);
  }
};