如何使用Polymer本地存储属性和值?
我的意图是创建一个引导式测验,但我希望完全在本地存储名称和选项等内容。我遵循了《在30分钟内构建一个应用程序》指南,但其中从未涉及如何在本地持久化数据如何使用Polymer本地存储属性和值?,polymer,Polymer,我的意图是创建一个引导式测验,但我希望完全在本地存储名称和选项等内容。我遵循了《在30分钟内构建一个应用程序》指南,但其中从未涉及如何在本地持久化数据 如有任何指导或建议,将不胜感激 我建议您将与核心ajax元素一起使用 mydata.json [{ "question":"A question here", "answer":"The answer", "other":"and so on.." }, { "question":"Another question
如有任何指导或建议,将不胜感激 我建议您将与核心ajax元素一起使用 mydata.json
[{
"question":"A question here",
"answer":"The answer",
"other":"and so on.."
},
{
"question":"Another question here",
"answer":"The answer",
"other":"and so on.."
}]
index.html
<core-ajax id='ajax' url='mydata.json' on-response='{{response}}' handleAs='json'>
<template repeat='{{data in json}}'>
<p>{{data.question}}</p>
<p>{{data.answer}}</p>
</template>
<script>
Polymer({
json: null,
ready: function(){
this.$.ajax.go();
},
response: function(e){
this.json = e.detail.response;
}
});
</script>
{{数据.问题}
{{data.answer}
聚合物({
json:null,
就绪:函数(){
这是$.ajax.go();
},
答复:职能(e){
this.json=e.detail.response;
}
});
这不是一个真正的问题。谢谢Paul提供的链接和信息,它看起来正是我需要的。如果我可以问一下,你有没有其他教程建议我使用polymer?除了polymer项目文档之外,我还不知道有那么多,但我觉得这个博客与众不同:谢谢你和Paul给了我一个完整的答案。