How to use the vue 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 amsik / liquor-tree / test / lib / Node.spec.js View on Github external
import Vue from 'vue'

import Node from '@/lib/Node'
import Tree from '@/lib/Tree'

import objectToNode from '@/utils/objectToNode'

const vm = new Vue()
vm.opts = {}

const tree = new Tree(vm)

describe('Lib: Node.js', () => {
  it('node constructor arguments', () => {
    expect(() => { new Node() }).toThrowError('Node can not be empty')
    expect(() => { new Node(null, {}) }).toThrowError('Node must has a Tree context!')

    // TODO: whether to check Tree instance?
  })

  it('node\'s specified and auto generated id', () => {
    const node0 = new Node(tree, { id: 10 })
    const node1 = new Node(tree, {})
github mtlynch / whatgotdone / frontend / src / main.js View on Github external
},
    router
  );
}

// This callback runs before every route change, including on page load.
router.beforeEach((to, from, next) => {
  if (to.meta.title) {
    document.title = to.meta.title(to);
  } else {
    document.title = 'What Got Done';
  }
  next();
});

new Vue({
  store,
  router,
  render: (h) => h(App),
}).$mount('#app');
github benc-uk / smilr / vue / src / main.js View on Github external
userProfile = {
      user: null
    }
  } else {
    // Already log in as fake admin user, bypassing all auth and login stuff
    userProfile = {
      user: {
        name: '[Auth Disabled]'
      },
      isAdmin: true
    }
  }

  // Mount the top level App component
  // Taken from Vue CLI template app, don't really understand what it all does
  new Vue({
    router,
    render: function (h) { return h(App) },
    beforeCreate: function() { }
  }).$mount('#app')
}
github hunterae / vue-table-for / examples / main.js View on Github external
// import VueSourceCodeBuilder from 'vue-source-code-builder'
import VueSourceCodeBuilder from 'vue-source-code-builder/src/plugin'
import VueInheritSlots from 'vue-inherit-slots'
import VueSlotHooks from 'vue-slot-hooks'
import 'prismjs/themes/prism-tomorrow.css'

Vue.use(TableFor)
Vue.use(VueSourceCodeBuilder)
Vue.use(VueInheritSlots)
Vue.use(VueSlotHooks)

if (process.env.NODE_ENV === 'production') {
  ga(router, 'UA-134944564-1')
}

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
github zhaoluting / front-end-designer / src / views / designerPage / components / mount.js View on Github external
setTimeout(() => {
      const data = {};
      if (_component.attributes) {
        Object.keys(_component.attributes).forEach((key) => {
          data[key] = _component.attributes[key].value;
        });
      }
      if (component.uid) { // 销毁旧实例

      }
      const vm = new Vue({
        name: id.toString(),
        data() {
          return data;
        },
        template: _component.template,
        el: document.getElementById(id),
        mounted() {
          this.$el.id = id;
          if (component) {
            component.uid = this._uid;
          }
          // 添加选中效果
          const info = myVue.$store.state.currentComponent.info;
          if (!info) this.$el.click();
        },
      });
github kaola-fed / megalo / test / unit / features / directives / model-text.spec.js View on Github external
it('should not fire input on initial render of textarea with placeholder in IE10/11', done => {
      const el = document.createElement('div')
      document.body.appendChild(el)
      const vm = new Vue({
        el,
        data: { foo: null },
        template: `<textarea placeholder="bar"></textarea>`
      })
      setTimeout(() =&gt; {
        expect(vm.foo).toBe(null)
        done()
      }, 17)
    })
  }
github wxsms / uiv / test / specs / scroll.spec.js View on Github external
it('should not bind non-function value', async () =&gt; {
    const res = Vue.compile('<div></div>')
    const vm = new Vue({
      data () {
        return {
          msg: 'hello'
        }
      },
      directives: {scroll},
      render: res.render,
      staticRenderFns: res.staticRenderFns
    })
    vm.$mount()
    await vm.$nextTick()
    expect(vm.$el[HANDLER]).not.exist
    vm.$destroy()
  })
github rotki / rotki / frontend / app / src / main.ts View on Github external
import 'roboto-fontface/css/roboto/roboto-fontface.css';
import 'font-awesome/css/font-awesome.css';
import { Interop } from '@/plugins/interop';
import vuetify from '@/plugins/vuetify';
import { setupPremium } from '@/utils/premium';
import router from './router';
import store from './store/store';

Vue.config.productionTip = false;

Vue.use(Api);
Vue.use(Interop);

setupPremium();

new Vue({
  vuetify,
  router,
  store,
  render: h => h(App)
}).$mount('#app');
github SimonZhangITer / vue-typescript-dpapp-demo / src / main.ts View on Github external
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import VueLazyload from 'vue-lazyload'
import './assets/mock'

Vue.use(VueLazyload, { preLoad: 1 })

Vue.config.productionTip = false

const app: Vue = new Vue({
  el: '#app',
  router,
  store,
  render: h => h(App)
})

export default app
github ittus / vue-long-click / src / main.js View on Github external
import Vue from 'vue'
import App from './App.vue'
import { longClickDirective } from './index'

Vue.config.productionTip = false

const longClickInstance = longClickDirective({delay: 400, interval: 50})
Vue.directive('longclick', longClickInstance)

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