How to use the vue.extend 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 xiaoqiang-zhao / cellar / web / src / components / article-list / article-list.js View on Github external
/**
 * 文章列表页模块
 *
 * Created by zhaoxiaoqiang on 15/12/23.
 */
var Vue = require('vue');
var $ = require('jQuery');
var template = require('./article-list.tpl');

// 依赖的样式
require('./article-list.css');
require('../icon/tag.css');

var articleList = Vue.extend({
    data: function () {
        var me = this;
        $.ajax({
            url: '/articles/articles.json',
            success: function (data) {
                // 按时间排序
                data.sort(function (item1, item2) {
                    return item2.createDate - item1.createDate;
                });
                me.$data.list = data;
            }
        });

        return {
            list: []
        };
github harryho / vue2crm / test / unit / specs / About.spec.js View on Github external
it('should render correct contents', () => {
    const Constructor = Vue.extend(About)
    const vm = new Constructor().$mount()
    expect(vm.$el.querySelector('h2').textContent)
      .to.equal('About')
  })
})
github gitlabhq / gitlabhq / app / assets / javascripts / boards / components / board_delete.js View on Github external
import Vue from 'vue';
import { GlButton, GlTooltipDirective } from '@gitlab/ui';
import { __ } from '~/locale';
import { hide } from '~/tooltips';

export default Vue.extend({
  components: {
    GlButton,
  },
  directives: {
    GlTooltip: GlTooltipDirective,
  },
  props: {
    list: {
      type: Object,
      default: () => ({}),
      required: false,
    },
  },
  methods: {
    deleteBoard() {
      hide(this.$el);
github tianyong90 / we-vue / packages / top-tips / index.js View on Github external
const createInstance = () => {
  instance = new (Vue.extend(TopTipsComponent))({
    el: document.createElement('div')
  })

  instance.$on('update:visible', visible => {
    instance.visible = visible
  })

  document.body.appendChild(instance.$el)
}
github gitlabhq / gitlabhq / spec / javascripts / notes / components / note_edited_text_spec.js View on Github external
beforeEach(() => {
    const Component = Vue.extend(noteEditedText);
    props = {
      actionText: 'Edited',
      className: 'foo-bar',
      editedAt: '2017-08-04T09:52:31.062Z',
      editedBy: {
        avatar_url: 'path',
        id: 1,
        name: 'Root',
        path: '/root',
        state: 'active',
        username: 'root',
      },
    };

    vm = new Component({
      propsData: props,
github dawg / vusic / src / utils.ts View on Github external
export const vueExtend = (proxy: ReturnType) => {
  return Vue.extend(proxy as any);
};
github maxpert / raspchat / static / js / components / settings-dialog.js View on Github external
/*
Copyright (c) 2015 Zohaib
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

var vue = require('vue');
var doc = window.document;

vue.component('settings-dialog', vue.extend({
    template: '#settings-dialog',
    props: {
        visible: {
            type: Boolean,
            twoWay: true,
        }
    },
    data: function () {
        return {};
    },
    ready: function () {
        this.$watch('visible', this.hookEscape);
    },
    methods: {
        ignoreClose: function () {
        },