gpt4 book ai didi

javascript - 创建待办事项列表 Web 应用程序

转载 作者:行者123 更新时间:2023-12-03 05:22:52 25 4
gpt4 key购买 nike

如何在 Angular JS 中创建一个待办事项列表,在计算机系统中以文件形式存储待办事项列表。我已经尝试过使用 http 服务:get 和 post。但我这样做时遇到错误..待办事项列表存储在网络存储中,但不存储在计算机中

最佳答案

这将允许您右键单击并另存为 JSON 文件。

然后您可以在计算机上使用所述文件或将其上传到同一网站或另一个网站:

//Reference a tag
var link = document.getElementById("downloadLink");

//Dummy data todos
var todos = [{
name: 1,
text: "hello world"
},{
name: 2,
text: "hello world"
}];

//Create download link
link.setAttribute("href", 'data:text/json,' + JSON.stringify(todos))
<a id="downloadLink" href="#nuthinYet" target="_blank" download="test.json">download</a>

关于javascript - 创建待办事项列表 Web 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41299233/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com