0
我想直接返回結果(通常我們會嘗試將數據存入數據並訪問該數據,但現在我想要的是直接)。當我們撥打hello()
函數時,我想返回result
變量。 我嘗試如下,但它不會返回耶。我該如何嘗試?如何在不使用數據的情況下返回Vue資源?
hello: function() {
var result = "";
this.$http.get(window.location.href).success(function(data) {
result = data;
}).error(function (data, status, request) {
});
return result;
}
你簡單地使用返回的資源,然後做完你需要的東西后會更好。等待結果填充將是錯誤的。 – Oddman