Skip to content

A tiny library to enable you work with PouchDB in a Vuejs app. It syncs with remote CouchDB too :-)

Notifications You must be signed in to change notification settings

sadick254/vuepouch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Vuepouch

A tiny library to enable you work with PouchDB in a Vuejs app. It syncs with remote CouchDB too :-)

Installation

Installing Vuepouch is as easy as including it in your html script tag. Being that it is a vuejs mixin it has a dependancy on vuejs. So dont forget to include that.

<script src="vue.js"></script>
<script src="vuepouch.js"></script>

Usage

Vuepouch by default gets auto installed when you include it in your html. You dont have to to Vue.use(vuepouch).

var app = new Vue({
  el: "#app",
  pouchdb: {
    uber: {
      localDB: "uber",
      remoteURL: "http://127.0.0.1:5984/uber"
    }
  },
  computed: {
    drivers () {
      return this.uber.drivers
    },
    passengers () {
      return this.uber.passengers
    }
  }
})

Adding data

...
methods: {
  addDriver () {
    this.$pouchdbRefs.uber.put('drivers',/*your data*/)
  },
  addPassenger () {
    this.$pouchdbRefs.uber.put('passengers', /*your data*/)
  } 
}

Deleting data

this.$pouchdbRefs.uber.remove(/*your data*/)

Updating data

this.$pouchdbRefs.uber.update(/*your data*/)

Displaying data in your html

<div id="app">
  <ul>
    <li v-for="driver in drivers">{{driver.name}}</li>
  </ul>
</div>

About

A tiny library to enable you work with PouchDB in a Vuejs app. It syncs with remote CouchDB too :-)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published