0
我遵循laracast上Jeffrey way的vuejs教程的所有步驟,但仍然無法在從app.js數據調用app.blade.php中的currentView時解析組件。但是,當我明確地調用結帳視圖頁面(組件是=「結帳視圖」)它工作正常。我怎樣才能解決這個問題,因爲我想用currentView引用checkout-view?下面是我的代碼:如何解決無法解決vues js和laravel中的組件{{currentView}}?
app.blade.php
<body class="container">
<div id="app">
<component is="@{{currentView}}"></component>
</div>
<script type="text/javascript" src="/js/app.js"></script>
</body>
</html>
app.js
var Vue = require('vue');
new Vue({
el: '#app',
data:{
currentView: 'checkout-view'
},
components: {
'checkout-view' : require('./views/checkout')
}
});
checkout.js
module.exports = {
template: require('./checkout.template.html'),
components: {
coupon: require('../components/Coupon.js')
}
}
謝謝解決了我的問題。 –