![](/img/trans.png)
[英]How to separate vue.js template into a .vue file while leaving code in .js?
[英]How to write Vue js code in separate file and include in laravel
如何在單獨的文件中編寫Vue js代碼並將其包含在laravel Blade頁面代碼中?
我也使用gulp文件。
@section('js')
<script>
new Vue({
// Defining a element.
el: '#branddashboard-html',
data: {
// Defining data variable.
brandStats: null
},
// On load functionality.
created: function () {
// Initializing method.
this.getData();
},
},
// Methods to implement.
methods: {
getData: function () {
self.brandStats = null;
$.get('brand-stats/' + userId + '/' + period, function (data) {
self.brandStats = data;
});
}
}
});
</script>
@endsection
我認為這不是最好的主意。 我認為,刀片服務器的模板只能在views文件夾中使用。 現在,您的前端邏輯通過MVVM vue方式由Vue組件系統管理。 希望這對您有用
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.