How to use the vuex-pathify.get 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
*
       * Pathify chooses same-named getters over same-named states, in this case returning an array of Icon
       * instances with transformed properties and additional methods, rather than just a plain Object
       *
       * 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)
github pkkid / pushingkarma / src / components / notes / NotesSearch.vue View on Github external
import ScrollBox from '@/components/ScrollBox';
  import trim from 'lodash/trim';
  import Vue from 'vue';

  export default {
    name: 'NotesSearch',
    mixins: [NotesMixin],
    components: {ScrollBox},
    data: () => ({
      cancelSearch: null,  // Cancel search token
      highlighted: null,   // Highlighed note id
      notes: [],           // List of search results
      search: null,        // Current search string
    }),
    computed: {
      noteid: pathify.get('notes/note@id'),
    },
    watch: { 
      // Watch Highlighted
      // Make sure item is visible
      highlighted: async function() {
        await Vue.nextTick();
        var container = document.querySelector('#search-results .scrollbox');
        var item = document.querySelector(`#search-results .submenuitem[noteid='${this.highlighted}']`);
        if (item) { utils.keepInView(container, item, 50, 'auto'); }
      },
      
      // Watch Search
      // Update results, history, and highlighted item.
      search: async function() {
        this.cancelSearch = api.cancel(this.cancelSearch);
        var token = this.cancelSearch.token;
github pkkid / pushingkarma / src / components / notes / NotesEditMenu.vue View on Github external
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});
      },

      // Watch UserID
      // If userid ever changes, make sure we stop editing.
github vuetifyjs / vuetify / packages / docs / src / layouts / documentation / Contribution.vue View on Github external
import { upperFirst, camelCase } from 'lodash'
  import { parseLink } from '@/util/helpers'

  export default {
    name: 'DocumentationContribution',

    props: {
      branch: {
        type: String,
        default: 'master',
      },
    },

    computed: {
      lang: get('route/params@lang'),
      namespace: get('route/params@namespace'),
      page: get('route/params@page'),
      test: get('route/params'),
      contributionGuide () {
        return this.parseLink('', 'contribute', `/${this.lang}/getting-started/contributing`)
      },
      contributionLanguageCrowdin () {
        return this.parseLink('', 'Crowdin', `/${this.namespace}/${this.page}`)
      },
      contributionPageGithub () {
        return this.parseLink('', 'Edit this page on GitHub!', this.contributionPageLink)
      },
      contributionPageLink () {
        const file = `${this.namespace}/${upperFirst(camelCase(this.page))}.json`
        console.log(this.test)
        return `https://github.com/vuetifyjs/vuetify/tree/${this.branch}/packages/docs/src/data/pages/${file}`
      },
github Gingernaut / Peridot / src / components / admin-edit-user.vue View on Github external
beforeCreate() {},
  created() {
    this.id = this.payload.id
    this.firstName = this.payload.firstName
    this.lastName = this.payload.lastName
    this.emailAddress = this.payload.emailAddress
    this.phoneNumber = this.payload.phoneNumber
    this.isVerified = this.payload.isVerified
    this.userRole = this.payload.userRole
    this.createdTime = this.payload.createdTime
    this.modifiedTime = this.payload.modifiedTime
  },
  beforeMount() {},
  mounted() {},
  computed: {
    loggedInUserRole: get("account/userRole"),
    isAdmin: function() {
      return this.loggedInUserRole === "ADMIN"
    },
  },
  methods: {
    saveAccountChanges() {
      let changedData = this.changedFields()

      if (Object.values(changedData).length < 1) {
        this.$buefy.toast.open({
          duration: 2000,
          message: "No changes to save",
          position: "is-top",
          type: "is-info",
        })
        return
github Gingernaut / Peridot / src / components / navbar-comp.vue View on Github external
export default {
  name: "Navbar",
  components: {},
  mixins: [],
  data() {
    return {
      modalComp: null,
      showMobileNav: false,
    }
  },
  beforeCreate() {},
  created() {},
  beforeMount() {},
  mounted() {},
  computed: {
    showNavbar: get("ui/showNavbar"),
    isLoggedIn: get("account/isAuthenticated"),
    userRole: get("account/userRole"),
    isAdmin: function() {
      return this.userRole === "ADMIN"
    },
  },
  methods: {
    closeModal() {
      this.modalComp = null
    },
    openSignup() {
      this.modalComp = () => import("@/components/signup-form")
    },
    openLogin() {
      this.modalComp = () => import("@/components/login-form")
    },