我有laravel Vue应用程序,它与chrome和Firefox完美兼容。但在Edge或IE11上不起作用,并且控制台在箭头功能上显示错误! 如何使用Laravel Mix和Webpack编译或转换为es5? 您可以显示webpack.mix.js的正确配置吗? tnx很多
答案 0 :(得分:2)
为了将es6代码编译为es5,请执行以下步骤:
1)安装babel-env预设
npm install @babel/preset-env --save
然后在根目录的.babelrc中声明它:
{
"presets": ["@babel/preset-env"]
}
2)使用
编译代码npm run dev //for dev environment
或
npm run prod // for production environment
答案 1 :(得分:2)
更新2020年2月
如果仍然有人需要帮助,Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://delhidailyservice.com/api/")
.addConverterFactory(GsonConverterFactory.create())
.build();
APIService request = retrofit.create(APIService.class);
Call<LeadData> call = request.leadData(prefConfig.readLoginId());
call.enqueue(new Callback<LeadData>() {
@Override
public void onResponse(Call<LeadData> call, Response<LeadData> response) {
/* new Handler().postDelayed(new Runnable() {
public void run() {
// if (isAdded()) {
pDialog.dismiss();
// }
}
}, 5000);*/
pDialog.dismiss();
LeadData allEvent = response.body();
allEventData = (List<Leads>) allEvent.getData();
// Log.d("Error", ""+allEventData.size());
allEventDatanew.clear();
for (int i = 0; i < allEventData.size(); i++) {
if (todayAsString.equalsIgnoreCase(allEventData.get(i).getDate())) {
Leads allevent = new Leads();
String service = allEventData.get(i).getService();
String date = allEventData.get(i).getDate();
String name = allEventData.get(i).getName();
String time = allEventData.get(i).getTime();
String city = allEventData.get(i).getCity();
String status = allEventData.get(i).getStatus();
String credit = allEventData.get(i).getCredit();
String address = allEventData.get(i).getAddress();
String id = allEventData.get(i).getLeadId();
try {
//String details = allEventData.get(i).getDetail();
//abcd = Html.fromHtml(details).toString();
// tv_detail.setText(abcd);
} catch (Exception e) {
e.printStackTrace();
}
allevent.setService(service);
allevent.setDate(date);
allevent.setName(name);
allevent.setTime(time);
allevent.setCity(address + " , " + city);
allevent.setStatus(status);
allevent.setCredit(credit);
allevent.setLeadId(id);
allEventDatanew.add(allevent);
}
}
// Log.d("Error1", ""+allEventDatanew.size());
individualDataAdapter = new LeadAdapter(allEventDatanew, getContext());
recyclerViewIndividualEvent.setAdapter(individualDataAdapter);
individualDataAdapter.notifyDataSetChanged();
已经为es5提供了babel编译:
mix.scripts()的一个小变化是mix.babel()。它的方法 签名与脚本相同;但是,级联文件将 接收Babel编译,该编译将任何ES2015代码转换为Vanilla 所有浏览器都将理解的JavaScript。
您可以像这样使用它:
mix
答案 2 :(得分:0)
经过大量搜索,我发现此Vue组件导致错误“ https://github.com/godbasin/vue-select2”,我该如何将其编译为es5。
边缘控制台错误:
Expected identifier, string or number
及其对应的行是这样的:
setOption(val = []) {
this.select2.empty();
this.select2.select2({
-----> ...this.settings,
data: val
});
this.setValue(this.value);
},
很抱歉花时间