0.1.0 • Published 7 years ago

nuxt-pouch v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
7 years ago

PouchDB (WIP)

Adds pouchdb to your nuxt application using vue-pouch, tightly integrating functionality from pouch-find, pouchdb-live-find and pouchdb-authentication.

(Better docs coming soon)

Setup

  • Add nuxt-pouch dependency using yarn or npm to your project
  • Add nuxt-pouch module to nuxt.config.js:
  modules: [
    'nuxt-pouch'
  ]

Usage

<template>
  <div class="todo-list">
    <input v-model="message" placeholder="New Todo">
    <button @click="$pouch.post('todos', {message: message});message=''">Save Todo</button>
    <ol>
      <li v-for="todo in todos">
        <input v-model="todo.message" @change="$pouch.put('todos', todo)">
        <button @click="$pouch.remove('todos', todo)">Remove</button>
      </li>
    </ol>
  </div>
</template>

<script>
  export default {
    // VuePouch adds a `pouch` config option to all components.
    pouch: {
      // The simplest usage. queries all documents from the "todos" pouch database and assigns them to the "todos" vue property.
      todos: {/*empty selector*/}
    }
  }
</script>

See the vue-pouch repo for documentation.