list_messages() hinzugefügt
This commit is contained in:
parent
56b238ad32
commit
b5eb4c2b79
@ -14,7 +14,7 @@ const HomeRouter = {
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
refresh_messages: function () {
|
/*refresh_messages: function () {
|
||||||
_messages.push({ //////// alt
|
_messages.push({ //////// alt
|
||||||
id: 42,
|
id: 42,
|
||||||
subject: "xxx",
|
subject: "xxx",
|
||||||
@ -22,23 +22,41 @@ const HomeRouter = {
|
|||||||
user: "nobody",
|
user: "nobody",
|
||||||
tags: "foo"
|
tags: "foo"
|
||||||
});
|
});
|
||||||
},
|
},*/
|
||||||
|
list_messages: function () {
|
||||||
|
console.log("egal");
|
||||||
|
$.get('api/ids/').done(function (jd) {
|
||||||
|
// _messagelist = jd;
|
||||||
|
_messagelist.splice(0, _messagelist.length);
|
||||||
|
_messagelist.push.apply(_messagelist, jd);
|
||||||
|
console.log("egal2");
|
||||||
|
//$('#xxx').text(jd[0]);
|
||||||
|
for (var e in jd) {
|
||||||
|
if (!_messages[jd[e]]) {
|
||||||
|
get_insert_message(jd[e]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).fail(function (e, f, g) {
|
||||||
|
console.log("egal3: " + e + f + g);
|
||||||
|
});
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
/*mounted: function() {
|
mounted: function() {
|
||||||
this.refresh_messages();
|
this.list_messages();
|
||||||
}*/
|
/*this.refresh_messages();*/
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function get_insert_message(id) {
|
function get_insert_message(msg_id) {
|
||||||
$.get(id + ".json").done(function (msg) {
|
$.get(api/msg/{msg_id}).done(function (msg) {
|
||||||
// _messages[id] = msg;
|
// _messages[id] = msg;
|
||||||
Vue.set(_messages, id, msg);
|
Vue.set(_messages, id, msg);
|
||||||
}).fail(function (e, f, g) {
|
}).fail(function (e, f, g) {
|
||||||
console.log("cannot load " + id + ".json: " + e + f + g);
|
console.log("cannot load " + id + ".json: " + e + f + g);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
$(document).ready(function () {
|
/*$(document).ready(function () {
|
||||||
console.log("egal");
|
console.log("egal");
|
||||||
$.get('list.json').done(function (jd) {
|
$.get('list.json').done(function (jd) {
|
||||||
// _messagelist = jd;
|
// _messagelist = jd;
|
||||||
@ -54,4 +72,4 @@ $(document).ready(function () {
|
|||||||
}).fail(function (e, f, g) {
|
}).fail(function (e, f, g) {
|
||||||
console.log("egal3: " + e + f + g);
|
console.log("egal3: " + e + f + g);
|
||||||
});
|
});
|
||||||
});
|
});*/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user