-1
現在我從火力如何在功能上得到的價值和替換變量
database = firebase.database();
var ref = database.ref('urls');
ref.on('value', gotData, errData);
function errData(err){
console.log('Error!');
console.log(err);
}
function gotData(data){
result = data.val()
const urls = Object.keys(result)
.filter(key => result[key].last_res > 5)
.map(key => ({url: 's/price/' + result[key].url_site + '/'}))
console.log(urls)
}
結果網址獲得的數據是
[ { url: '/cream/' },
{ url: '/salmon/' },
{ url: '/salmon-s/' } ]
我需要在URL中發送數據替換如下
var sitemap = sm.createSitemap({
hostname: 'xxx.com',
urls: [ { url: 'xxx' },
{ url: 'xxx' },
{ url: 'xxx' } ]
});
我該怎麼做?