0

Have this html

<f7-input type="switch"  :checked="{typeS}"></f7-input>

JS (vue)

export default {
      data() {
            type: []
        },
        mounted: function () {


 this.fetchType();
    },
    methods: {
        fetchType: function(){
            var typeS = [];
            this.$http.get('http://re/api/data').then(function(response){
                this.type = response.body.object[0].type;
                if(this.type = 'S') {
                    typeS = 'true'
                }
            }, function(error){
                console.log(error.statusText);
            });
        },
      }

}

and i need when if(this.type = 'S') change inputn attribute on checked. I'm already confused about what's what. Can someone help?

  • Inside `function (response)`, `this` is not properly set. – Roy J Dec 01 '17 at 17:54
  • @thanksd VueResource actually sets `this` for the callback . https://codepen.io/Kradek/pen/XzowrJ?editors=1010 – Bert Dec 01 '17 at 18:36
  • I'm not sure I understand what you want to do here. Could you clarify your question a bit? Also, would you confirm you are using VueResource? – Bert Dec 01 '17 at 18:40

0 Answers0