Skip to content

Instantly share code, notes, and snippets.

@hightemp
Last active September 29, 2018 12:32
Show Gist options
  • Save hightemp/11b017c3f8f758fd9d9012666966c48e to your computer and use it in GitHub Desktop.
Save hightemp/11b017c3f8f758fd9d9012666966c48e to your computer and use it in GitHub Desktop.

Revisions

  1. hightemp revised this gist Sep 8, 2018. 1 changed file with 16 additions and 1 deletion.
    17 changes: 16 additions & 1 deletion snippets.md
    Original file line number Diff line number Diff line change
    @@ -1,4 +1,19 @@
    # Vue snippets
    ## Watch vuex state changes
    ```javascript
    computed: {
    doneTodosCount () {
    return this.$store.getters.doneTodosCount
    }
    }

    watch:{
    doneTodosCount(value) {
    console.log('My store value for 'doneTodosCount' changed to '+value);
    }
    }
    ```

    ## Computed getters doesn't work
    ```javascript
    Vue.component(
    @@ -7,7 +22,7 @@ Vue.component(
    // ...
    computed: {
    sValue: {
    cache: false,
    cache: false, // add this
    get ()
    {
    // ...
  2. hightemp revised this gist Aug 29, 2018. 1 changed file with 18 additions and 11 deletions.
    29 changes: 18 additions & 11 deletions snippets.md
    Original file line number Diff line number Diff line change
    @@ -1,17 +1,24 @@
    # Vue snippets
    ## Computed getters doesn't work
    ```javascript
    computed: {
    sValue: {
    cache: false,
    get ()
    {
    //
    Vue.component(
    'component-name',
    {
    // ...
    computed: {
    sValue: {
    cache: false,
    get ()
    {
    // ...
    },
    set (sValue)
    {
    // ...
    }
    }
    },
    set (sValue)
    {
    //
    }
    // ...
    }
    },
    );
    ```
  3. hightemp created this gist Aug 29, 2018.
    17 changes: 17 additions & 0 deletions snippets.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    # Vue snippets
    ## Computed getters doesn't work
    ```javascript
    computed: {
    sValue: {
    cache: false,
    get ()
    {
    //
    },
    set (sValue)
    {
    //
    }
    }
    },
    ```