Git Product home page Git Product logo

vuepouch's Introduction

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>

vuepouch's People

Contributors

sadick254 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

vuepouch's Issues

Usage

i am a javascript noob, but i think that your Usage code has 2 mistakes:
localdb: "uber", should be localDB: "uber",
and
computed () { should be computed: {
correct me if i am wrong
but i still can't get your example to work, because i don't know how your database looks like.
i would be really grateful if you could provide a JSON file with drivers and passengers object
thank you!

How could I get the information from the pouchdb

I could only add,update or delete the record. How could I retrieve the information from PouchDb. Is there any other method like db.get() to retrieve the information from PouchDb.

Thanks for the nice code!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.