2016-09-29 89 views
0

This page提到聚合物:使用App-IndexedDB的镜与聚合物文档应用-pouchdb文档

由于PouchDB可以自动与本地IndexedDB的数据库同步数据,它从来没有被更容易添加offline-第一个数据访问您的渐进网络应用程序。

我对Indexeddb和pouchdb相当陌生,实际上很难将其付诸实践。我的代码到目前为止:

<iron-ajax 
     auto 
     url="../data/some_data.json" 
     handle-as="json" 
     last-response="{{liveData}}"> 
    </iron-ajax> 

    <app-indexeddb-mirror 
     key="thedata" 
     data="{{liveData}}"> 
    </app-indexeddb-mirror> 

    <app-pouchdb-document 
     id="pouchdb" 
     db-name="data" 
     doc-id="thedata" 
     data="{{storedData}}"> 
    </app-pouchdb-document> 

    <template is="dom-repeat" items="{{storedData}}" as="item"> 
     <div>[[item.name]]</div> 
    </template> 

上述不起作用。并且打印pouchdb的所有文档都是空白的。有人可以提供一个工作示例吗?或者至少澄清这两个要素之间的关系?

回答

0

Pouchdb直接使用IndexDB,所以你不需要使用app-indexdb-mirror。