Skip to content

Instantly share code, notes, and snippets.

@fredyfx
Created December 31, 2018 10:14
Show Gist options
  • Save fredyfx/983605d64910281c584b221aee7481c4 to your computer and use it in GitHub Desktop.
Save fredyfx/983605d64910281c584b221aee7481c4 to your computer and use it in GitHub Desktop.
Archivo incial del VueJS
var app = new Vue({
el: "#primervue",
data: {
titulo: "Primeros pasos con VueJS y el buen @fredyfx"
}
});
var app2 = new Vue({
el: "#segundovue",
data: {
productos: []
},
methods: {
obtenerLista: function() {
return this.productos;
}
},
created: function() {
console.log("funcion creada");
this.$http.get("http://localhost:5000/api/producto")
.then(function(respuesta) {
this.productos = respuesta.body;
}, function() {
alert("Entra en modo Detective Zen y encuentra la causa del error");
}).then(function() {
console.log("Finalmente tenemos: ");
console.log(this.productos);
});
}
});
console.log("aqui se supone que hay un archivo extenso de javascript");
console.log("powered by @fredyfx");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment