<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>

<div id="vue-instance">

    <textarea></textarea>

    <article v-html="trabalhado"></article>

    <button @click="transforme">Ok</button>

</div>

<script src="https://cdn.jsdelivr.net/vue/2.1.6/vue.js"></script>
<script src="https://cdn.jsdelivr.net/vue.resource/1.0.3/vue-resource.min.js"></script>

<script>
var vm = new Vue({
    el: '#vue-instance',
    data: {
        cru: 'Hello world',
        trabalhado: ''
    },
    methods: {
        transforme: function() {
            this.$http({
                url: 'https://jsonplaceholder.typicode.com/posts/1',
                method: 'GET'
                }).then(function(response) {
                this.trabalhado = response.data;
            }, function(response) {
                this.trabalhado = 'erro';
            });
        }

    }    
});
</script>

</body>
</html>

results matching ""

    No results matching ""