简体   繁体   English

使用Vue.js的Laravel 5.7

[英]Laravel 5.7 with Vue.js

i have created a new Laravel 5.7 project with webpack. 我用webpack创建了一个新的Laravel 5.7项目。 Now after compiling files with webpack VueJs is not working means not showing component to inspect and even v-model is not working. 现在,使用Webpack编译文件后,VueJs无法正常工作,这意味着不显示要检查的组件,甚至v-model也无法正常工作。 i have used vuejs CDN and also install one but still does not work. 我用过vuejs CDN,也安装了一个,但仍然无法正常工作。

un-compiled JS file: 未编译的JS文件:

 import Vue from 'vue'; new Vue({ el: '#addProduct_', data: { netKg: 0, grossKg: 0, taric_hs: 'taric', hs_par: 'hs par', }, methods: { getHsPer:function(){ alert(123); if(this.taric_hs.length == 10) { console.log(123); axios.get('/products/getHsPercentage/'+this.taric_hs) .then(response =>[ this.hs_per = response.data.hs_percentage ]) } }, }, computed: { minGrossKg(){ return this.netKg; }, }, mounted() {}, }); Vue.config.devtools = true; 

Blade File: 刀片文件:

 <div class="container" id="addProduct_"> <div class="card-body"> <form method="post" role="form" action="/products"> @csrf <div class="form-row"> <div class="form-group col-md-3"> <label for="taricHs">TARIC HS</label> <input type="text" class="form-control" id="taricHs" name="taricHs" placeholder="TARIC HS" minlength="10" maxlength="10" v-model="taric_hs" @click="getHsPer()" required> </div> <div class="form-group col-md-3"> <label for="hsPer">Duty Percentage</label> <input type="number" class="form-control" id="hsPer" name="hsPer" placeholder="HS Percentage" v-model="hs_par" readonly> </div> </div> <button type="submit" class="btn btn-primary">Save</button> </form> </div> </div> <script src="{{ asset('js/addProduct.js') }}"></script> 

IF i use VueJs CDN link: "vue-devtool" show project is in product mode and console shows project is in development mode and still not showing root component in Vue tab and VueJs is also still not work. 如果我使用VueJs CDN链接:“ vue-devtool”显示项目处于产品模式,控制台显示项目处于开发模式,并且在Vue选项卡中仍未显示根组件,并且VueJs也仍然无法正常工作。 picture link below. 图片链接如下。 browser screen shot 浏览器屏幕截图

如果还没有,请重新启动浏览器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM