Skip to content

Instantly share code, notes, and snippets.

@jonathanjd
Created June 2, 2018 15:34
Show Gist options
  • Select an option

  • Save jonathanjd/6ecd857577315c8725f4a113f649ecfd to your computer and use it in GitHub Desktop.

Select an option

Save jonathanjd/6ecd857577315c8725f4a113f649ecfd to your computer and use it in GitHub Desktop.
JS Bin // source https://jsbin.com/livabef
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div id="app">
{{ nombreCompleto }}
<br>
{{ edadShow }}
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
<script id="jsbin-javascript">
new Vue({
el: "#app",
data: {
nombre: "Jonathan",
apellido: "Duran",
edad: 31
},
computed: {
nombreCompleto: { //nombreCompleto Inicio
set:function(newValue) {
var names = newValue.split(' ')
this.firstName = names[0]
this.lastName = names[names.length - 1]
},
get:function() {
return this.nombre + " " + this.apellido;
}
},//nombreCompleto Final
edadShow: function() {//edadShow
return "Mi Edad es:" + this.edad;
}
}
});
</script>
<script id="jsbin-source-javascript" type="text/javascript">new Vue({
el: "#app",
data: {
nombre: "Jonathan",
apellido: "Duran",
edad: 31
},
computed: {
nombreCompleto: { //nombreCompleto Inicio
set:function(newValue) {
var names = newValue.split(' ')
this.firstName = names[0]
this.lastName = names[names.length - 1]
},
get:function() {
return this.nombre + " " + this.apellido;
}
},//nombreCompleto Final
edadShow: function() {//edadShow
return "Mi Edad es:" + this.edad;
}
}
});</script></body>
</html>
new Vue({
el: "#app",
data: {
nombre: "Jonathan",
apellido: "Duran",
edad: 31
},
computed: {
nombreCompleto: { //nombreCompleto Inicio
set:function(newValue) {
var names = newValue.split(' ')
this.firstName = names[0]
this.lastName = names[names.length - 1]
},
get:function() {
return this.nombre + " " + this.apellido;
}
},//nombreCompleto Final
edadShow: function() {//edadShow
return "Mi Edad es:" + this.edad;
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment