File: app/components/grid/grid.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy  >  Hackernews Vue  >  app/components/grid/grid.js  >  Download  
File: app/components/grid/grid.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: Hackernews Vue
View information from Hackernews using Vue.js
Author: By
Last change:
Date: 5 years ago
Size: 875 bytes
 

Contents

Class file image Download
define([
    'vue',
    'app/components/grid/table/table',
    'text!app/components/grid/grid.html',
    'css!app/components/grid/grid.css',
], function (Vue, table, template) {

    // Create component class
    var Grid = Vue.extend({
        name: 'grid',
        template: template,
        data: function () {
            return {
                searchQuery: '',
                gridColumns: ['name', 'power'],
                gridData: [
                    {name: 'Chuck Norris', power: Infinity},
                    {name: 'Bruce Lee', power: 9000},
                    {name: 'Jackie Chan', power: 7000},
                    {name: 'Jet Li', power: 8000}
                ]
            }
        },
        components: {
            'grid-table': table
        }
    })
    // Create and registration component
    Vue.component('grid', Grid);
    return Grid;
});