2016-10-15 8 views
0

1xコード: これは動作しています。Vuejs移行1xから2xコンパイル機能

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

2倍の移行:

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. 

コンパイルドキュメント:http://vuejs.org/api/#Vue-compile

答えて

0

ソリューション:

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

文字列を必要とVue.compile。私はjQueryを使ってそれを行うが、しようとする方法をどのように正確に知らない

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

関連する問題