我在线打开http://dev.yathit.com/demo/ydn-db-text/animals/animals.html演示,它工作。但是当我尝试在离线模式下使用这个演示时,出现了问题。
这些错误消息在我输入内容后立即出现:
Chrome(--allow-file-access-from-files
启用标志):
Uncaught TypeError: Object [object Object] has no method 'search' --> animals.js:111
Animals.handleSearch
火狐:
TypeError: this.db.search is not a function
var rq = this.db.search('name', this.ele_input_.value);
animals.js (line 111)
顺便说一句,我已经“加载了 2359 只动物,索引……完成”。消息,这意味着数据库已加载,但有什么问题var rq = this.db.search('name', this.ele_input_.value)
?
更新
我检查了https://github.com/yathit/ydn-db-fulltext/blob/master/examples/animals/animals.html源,现在我看到了问题:两个本地 js 文件(ydn-db.js
和animals.js
)是不够的,这个应用程序有很多依赖项:
<script src="../../../closure-library/closure/goog/base.js"></script>
<script src="../../../closure-library/closure/goog/deps.js"></script>
<script src="../../../ydn-base/src/deps.js"></script>
<script src="../../../ydn-db/src/deps.js"></script>
<script src="../../../natural/js/deps.js"></script>
<script src="../../../fullproof/js/deps.js"></script>
<script type="text/javascript"
src="../../../fullproof/js/tokenizer/categ_letters_numbers.js"></script>
<script type="text/javascript"
src="../../../fullproof/js/tokenizer/normalizer_lowercase.js"></script>
<script type="text/javascript"
src="../../../fullproof/js/tokenizer/normalizer_lowercase_nomark.js"></script>
<script type="text/javascript" src="../../src/deps.js"></script>
<script type="text/javascript">
goog.require('ydn.debug');
goog.require('ydn.db.crud.Storage');
goog.require('ydn.db.crud.Storage.text');
</script>
<script src="../../../ydn-db/config/crud.js"></script>
<script type="text/javascript" src="../../../ydn-db/src/ydn/db/tr/inject.js"></script>
<script type="text/javascript" src="../../../ydn-db/src/ydn/db/crud/inject.js"></script>
但这些文件不包含在可下载的 zip 包中。