Skip to content

Instantly share code, notes, and snippets.

@k33g
Last active April 18, 2019 05:49
Show Gist options
  • Select an option

  • Save k33g/f4ea54b6a2cf9555b959 to your computer and use it in GitHub Desktop.

Select an option

Save k33g/f4ea54b6a2cf9555b959 to your computer and use it in GitHub Desktop.

Revisions

  1. k33g revised this gist Nov 13, 2014. 1 changed file with 2 additions and 2 deletions.
    4 changes: 2 additions & 2 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -34,9 +34,9 @@ class HumansList extends Vue {
    }
    }

    var demo = new Demo()
    let demo = new Demo()

    window.humansList = new HumansList({
    let humansList = new HumansList({
    humans:[
    new Human(),
    new Human({firstName:"Jane", lastName:"Doe"})
  2. k33g revised this gist Nov 13, 2014. 1 changed file with 30 additions and 33 deletions.
    63 changes: 30 additions & 33 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -1,47 +1,44 @@
    /**
    * Created by k33g_org on 12/11/14.
    */

    class Human {
    constructor (arg={firstName:"John", lastName:"Doe"}) {
    this.fields = arg;
    }
    get (fieldName) {
    return this.fields[fieldName];
    }
    constructor (arg={firstName:"John", lastName:"Doe"}) {
    this.fields = arg;
    }

    get (fieldName) {
    return this.fields[fieldName];
    }

    set (fieldName, value) {
    this.fields[fieldName] = value;
    return this;
    }
    set (fieldName, value) {
    this.fields[fieldName] = value;
    return this;
    }
    }

    class Demo extends Vue {
    constructor () {
    var properties = {
    el: '#demo',
    data: {
    bob: new Human({firstName:"Bob", lastName:"Morane"})
    }
    };
    super(properties)
    }
    constructor () {
    var properties = {
    el: '#demo',
    data: {
    bob: new Human({firstName:"Bob", lastName:"Morane"})
    }
    };
    super(properties)
    }
    }

    class HumansList extends Vue {
    constructor (collection) {
    this.collection = collection;
    super({
    el: "#humans-list", data: collection
    })
    }
    constructor (collection) {
    this.collection = collection;
    super({
    el: "#humans-list", data: collection
    })
    }
    }

    var demo = new Demo()

    window.humansList = new HumansList({
    humans:[
    new Human(),
    new Human({firstName:"Jane", lastName:"Doe"})
    ]
    humans:[
    new Human(),
    new Human({firstName:"Jane", lastName:"Doe"})
    ]
    });
  3. k33g created this gist Nov 13, 2014.
    9 changes: 9 additions & 0 deletions index.html
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    <div id="demo">
    <h1>{{bob.fields.firstName}} {{bob.fields.lastName}}</h1>
    </div>

    <ul id="humans-list">
    <li v-repeat="humans">
    {{fields.firstName}} {{fields.lastName}}
    </li>
    </ul>
    47 changes: 47 additions & 0 deletions main.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,47 @@
    /**
    * Created by k33g_org on 12/11/14.
    */

    class Human {
    constructor (arg={firstName:"John", lastName:"Doe"}) {
    this.fields = arg;
    }
    get (fieldName) {
    return this.fields[fieldName];
    }

    set (fieldName, value) {
    this.fields[fieldName] = value;
    return this;
    }
    }

    class Demo extends Vue {
    constructor () {
    var properties = {
    el: '#demo',
    data: {
    bob: new Human({firstName:"Bob", lastName:"Morane"})
    }
    };
    super(properties)
    }
    }

    class HumansList extends Vue {
    constructor (collection) {
    this.collection = collection;
    super({
    el: "#humans-list", data: collection
    })
    }
    }

    var demo = new Demo()

    window.humansList = new HumansList({
    humans:[
    new Human(),
    new Human({firstName:"Jane", lastName:"Doe"})
    ]
    });