Extendin local component in VUE.js
Extending local component in VUE.js
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.0.3/vue.js"></script>
<div id = "domain">
</div>
JavaScript
var MainVue = Vue.extend({
data: function() {
return {
form: {
'name': '',
'git_repo': '',
'auto_deploy': '',
'create_db': ''
},
ajaxResponse: 'hello world'
};
}
});
var secondary_vue = new MainVue({
el: '#domain',
methods: {
postDomain: function() {
// do post in this place
/*
this.$http.post('{{ route('
domain.store ') }}',
function(data, status, request) {
this.$set('ajaxResponse', data);
}, {
data: this.form
}).error(function(data, status, request) {
this.$set('ajaxResponse', data);
});
*/
alert('postDomain called: ' + this.ajaxResponse);
}
}
});
secondary_vue.postDomain();