Skip to content

VLZH/vue-query-data-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vue query data sync

WARNING !

If you in looking for some lib for your project. Do not use this code! Quality of this code is very low

How to use

// main.js
// register plugin
import DataQueryString from "./plugins/data_query_sync";
// in component
module.exports = {
    data: {
        some_another_property: 0,
        category__id: 0,
        service__id: 0,
        // white list
        _syncInclude: ["order_by", "categories__id"]
        // black list
        // _syncExclude: ["some_another_property"]
    },
    watch: {
        // Push data to querystring on change in some properties
        category__id () {
            this.$pushToQuery()
        },
        service__id () {
            this.$pushToQuery()
        }
    },
    mounted () {
        // get a data from query string on component mount
        this.$getFromQuery()
    }
}

About

Plugin for sync query parameters and a data in vue component

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published