Cesur APAYDIN
Cesur APAYDIN

Reputation: 836

Vuejs Migration 1x to 2x Compile Function

1x Code: It is working.

this.$compile(this.$els.ajaxcontent);

2x Migration:

this.$compile(this.$refs.ajaxcontent);
// Error: $compile function not found.

Vue.compile(this.$refs.ajaxcontent);
// Error: template.trim not a function.

Vue.compile($('#ajaxContent').get(0));
// Error: template.trim not a function.

Compile Documentation : http://vuejs.org/api/#Vue-compile

Upvotes: 0

Views: 477

Answers (2)

Cesur APAYDIN
Cesur APAYDIN

Reputation: 836

Solution:

var tmp = Vue.extend({ 
    template: 'Content'
})
new tmp().$mount(' id or refs ')

Upvotes: 1

Psi
Psi

Reputation: 474

Vue.compile needs a String. I dont know how exactly how to do it with jquery but try

Vue.compile(document.getElementById('ajaxContent').innerHTML)

Upvotes: 0

Related Questions