| 本帖最后由 芯☆淡茹水 于 2017-10-29 22:21 编辑 
 要不你可以直接把描述写成脚本格式,再用 JSON.parse 来转换。
 比如 物品1 的描述是:'[123,一二三]'
 alert(JSON.parse($dataItems[1].description)[0])  => 123
 alert(JSON.parse($dataItems[1].description)[1])  => 一二三
 如果翻译成其他文字,在脚本里你也需要一个个的改啊!那和在数据库有什么分别?
 另外,改完储存好像是酱紫,比如物品;
 var fs = require('fs');var path = window.location.pathname.replace(/(\/www|)\/[^\/]*$/, '/data/');if (path.match(/^\/([A-Z]\:)/)) path = path.slice(1);path = decodeURIComponent(path) + 'Items.json';var data = JSON.stringify($dataItems);fs.writeFile(path, data, function(err){alert(!!err ? err : '储存OK');});
var fs = require('fs'); 
var path = window.location.pathname.replace(/(\/www|)\/[^\/]*$/, '/data/'); 
if (path.match(/^\/([A-Z]\:)/)) path = path.slice(1); 
path = decodeURIComponent(path) + 'Items.json'; 
var data = JSON.stringify($dataItems); 
fs.writeFile(path, data, function(err){alert(!!err ? err : '储存OK');}); 
 
 
 |