File: app/components/hackernews/hackernews.js

Recommend this page to a friend!
  Classes of Sergey Beskorovayniy  >  Hackernews Vue  >  app/components/hackernews/hackernews.js  >  Download  
File: app/components/hackernews/hackernews.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: 633 bytes
 

Contents

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

    // Create component class
    var Hackernews = Vue.extend({
        name: 'hackernews',
        template: template,
        created: function () {
            // register filters globally
            Vue.filter('fromNow', filters.fromNow);
            Vue.filter('domain', filters.domain);
        }
    });

    // Create and registration component
    Vue.component('hackernews', Hackernews);

    return Hackernews;
});