How to use the vuex-pathify.sync function in vuex-pathify

To help you get started, we’ve selected a few vuex-pathify 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 davestewart / vuex-pathify / demo / src / examples / api / Properties.vue View on Github external
*
       * The Icon class demonstrates:
       *
       *  - new properties from existing values, i.e. title and hex color
       *  - a render() function to transform existing values (SVG) at run time
       *
       * As the functionality is encapsulated on the Icon class, the methods can be called from anywhere.
       *
       * Try running this in the console:
       *
       *  - store.get('icons/data')[0].show()
       */
      icons: get('icons/data'),

      // sync style in store
      style: sync('icons/style'),
    },

    watch: {
      name: 'update',
      color : 'update',
    },

    // to target non SET_* members, use these techniques:
    methods: {

      // call mutation using direct access (!) syntax
      addIcon () {
        // try removing the ! to see what happens (check the console)
        // try using the commit() vuex alias to achieve the same
        this.$store.set('icons/ADD_ICON!', {name: this.name, color: this.color})
      },
github pkkid / pushingkarma / src / components / budget / BudgetYear.vue View on Github external
var UNCATEGORIZED = {name:'Uncategorized', budget:0};

  export default {
    name: 'BudgetYear',
    mixins: [TableMixin],
    components: {PageWrap, BudgetYearPopover},
    data: () => ({
      cancelsearch: null,   // Cancel search token
      tablerows: null,      // Row items to display
      search: null,         // Current search string
      loading: false,       // True to show loading indicator
      count: 0,             // Total transactions in view
      start: null,          // Starting month
    }),
    computed: {
      categories: pathify.sync('budget/categories'),
      columns: function() { return this.initColumns(); },
      items: function() { return this.tablerows; },
      keymap: function() { return this.tableMixinKeymap(); },
      months: function() { return this.initMonths(); },
    },
    watch: {
      search: function() {
        this.refresh(true);
      },
    },
    mounted: function() {
      document.title = `PushingKarma - Past Year Spending`;
      this.start = dayjs().startOf('month');
      this.search = trim(this.search || this.$route.query.search || '');
      //this.refresh();
    },
github vuetifyjs / vuetify / packages / docs / src / views / page / Index.vue View on Github external
/* webpackChunkName: "notfound" */
        '@/pages/general/404'
      ),
      PageSkeletonLoader: () => import('./SkeletonLoader'),
    },

    provide () {
      return { id: this.id }
    },

    data: () => ({ isLoading: false }),

    computed: {
      ...sync('route@params', ['namespace', 'page']),
      children: get('documentation/structure'),
      structure: sync('documentation/structure'),
      id () {
        if (!this.structure) return ''

        return this.page
      },
      text () {
        if (!this.structure) return ''

        return `${camelCase(this.namespace)}.${camelCase(this.page)}.headingText`
      },
    },

    watch: { '$route.path': 'onRouteChange' },

    asyncData: load,
github davestewart / vuex-pathify / demo / src / examples / typical / Pathify.vue View on Github external
export default {

    extends: base('repos1'),

    computed: {
      // get + path syntax
      repos: get('repos1/filteredItems'),

      // get + array syntax
      ...get('repos1', [
        'status',
        'readme'
      ]),

      // sync, sub-property + wildcard syntax
      ...sync('repos1/filters@*'),

      // sync, sub-property + object syntax
      ...sync('repos1/sort@', {
        sortOrder: 'order',
        sortKey: 'key',
      }),
    },

  }
github pkkid / pushingkarma / src / components / budget / Budget.vue View on Github external
import BudgetTransactions from './BudgetTransactions';
  import SidePanel from '@/components/site/SidePanel';
  import Dropzone from '@/components/Dropzone';
  import Navigation from '@/components/site/Navigation';
  
  export default {
    name: 'Budget',
    components: {BudgetMenu, BudgetMonth, BudgetYear, BudgetSettings,
      BudgetTransactions, Dropzone, Navigation, SidePanel},
    computed: {
      account: pathify.sync('budget/account'),
      accounts: pathify.sync('budget/accounts'),
      categories: pathify.sync('budget/categories'),
      summary: pathify.sync('budget/summary'),
      demo: pathify.sync('budget/demo'),
      view: pathify.sync('budget/view'),
    },
    watch: {
      view: function(view) {
        utils.updateHistory(this.$router, {view});
        window.scrollTo(0,0);
      },
      account: function(account) {
        var accountid = account ? account.id : null;
        utils.updateHistory(this.$router, {account:accountid});
        window.scrollTo(0,0);
      },
    },

    // Mounted
    // Setup navigation, demo, accounts
    created: async function() {
github pkkid / pushingkarma / src / components / notes / NotesEditMenu.vue View on Github external
Link, ListItem, OrderedList, Bold, Code, Italic, Strike, TodoItem,
    TodoList, Underline, History} from 'tiptap-extensions';
  import bash from 'highlight.js/lib/languages/bash';
  import css from 'highlight.js/lib/languages/css';
  import javascript from 'highlight.js/lib/languages/javascript';
  import python from 'highlight.js/lib/languages/python';
  import sql from 'highlight.js/lib/languages/sql';
  import xml from 'highlight.js/lib/languages/xml';
  var LANGUAGES = {bash,css,javascript,python,sql,xml};

  export default {
    name: 'NotesEditMenu',
    components: {EditorMenuBar},
    computed: {
      editing: pathify.sync('notes/editing'),
      editor: pathify.sync('notes/editor'),
      note: pathify.sync('notes/note'),
      userid: pathify.get('global/user@id'),
    },
    data: () => ({
      linkUrl: null,        // Current URL text when editing links
      showLinkMenu: false,  // True when displaying link input
    }),

    watch: {
      // Watch Editing
      // When edit mode changes, make sure TipTap is informed.
      editing: function() {
        let editable = this.editing && (this.userid !== null);
        this.editor.setOptions({editable});
      },
github davestewart / vuex-pathify / demo / src / examples / api / Components.vue View on Github external
export default {

    computed: {

      // single property
      store: get('module'),

      // accessor priority
      string: get('module/string'),

      // nested property syntax
      sub: sync('module/object@value'),
      nested: sync('module/object@a.b.c'),

      // array syntax
      ...sync('module', [
        'value',
        'string'
      ]),

      // object syntax
      ...get('module', {
        altValue: 'value',
        altString: 'string'
      }),
    }
  }
github vuetifyjs / vuetify / packages / docs / src / layouts / documentation / Toc.vue View on Github external
data: () => ({
      activeIndex: 0,
      currentOffset: 0,
      internalToc: [],
      tocTimeout: 0,
    }),

    computed: {
      ...get('documentation', [
        'headings',
        'namespace',
        'page',
      ]),
      structure: sync('documentation/structure'),
      supporters: sync('app/supporters'),
      toc () {
        const t = string => this.$t(`${this.namespace}.${this.page}.${string}`)

        return this.headings
          .map(h => {
            const translation = h.indexOf('.') > -1
              ? this.$t(h)
              : t(h)
            let text = translation.split(' ')

            text.shift()
            text = text.join(' ')

            return {
              id: kebabCase(text),
              text,
github pkkid / pushingkarma / src / components / budget / Budget.vue View on Github external
import * as utils from '@/utils/utils';
  import BudgetMenu from './BudgetMenu';
  import BudgetMonth from './BudgetMonth';
  import BudgetSettings from './BudgetSettings';
  import BudgetYear from './BudgetYear';
  import BudgetTransactions from './BudgetTransactions';
  import SidePanel from '@/components/site/SidePanel';
  import Dropzone from '@/components/Dropzone';
  import Navigation from '@/components/site/Navigation';
  
  export default {
    name: 'Budget',
    components: {BudgetMenu, BudgetMonth, BudgetYear, BudgetSettings,
      BudgetTransactions, Dropzone, Navigation, SidePanel},
    computed: {
      account: pathify.sync('budget/account'),
      accounts: pathify.sync('budget/accounts'),
      categories: pathify.sync('budget/categories'),
      summary: pathify.sync('budget/summary'),
      demo: pathify.sync('budget/demo'),
      view: pathify.sync('budget/view'),
    },
    watch: {
      view: function(view) {
        utils.updateHistory(this.$router, {view});
        window.scrollTo(0,0);
      },
      account: function(account) {
        var accountid = account ? account.id : null;
        utils.updateHistory(this.$router, {account:accountid});
        window.scrollTo(0,0);
      },