wkwebview 不支持本地文件发起的本地(file协议)ajax
wkwebview 不支持本地文件发起的本地(file协议)ajax失败
重现步骤
[步骤]
[结果]
[期望]
ios WKWebView 能支持file协议的ajax访问
App运行环境说明
plus 运行环境
[iOS版本号]
最新操作系统苹果手机
[手机型号]
不用具体型号
[模拟器型号]
附件
[App问题请提供可重现问题的代码片段,你补充的细一点,问题就解决的快一点]
[App安装包或H5地址]
[可重现代码片段]
核心代码片段:
define(function(require){
var m = require("mui");
var app = require("app");
var Vue = require("vue");
var http = require("http");
var echarts = require("echarts");
require('light');
require("date");
//这个代码不支持,这里会发起file协议的ajax请求
var tpl = require("../html/busi-stat-cp.html")
var cp1 = Vue.extend({
template:tpl,
props:{
},
data:function(){
return {
isFirstLoad:true,
list:[]
};
},
computed:{
},
methods:{
loadStatData: function(callback) {
var self = this;
var params = {
};
http.post('/api/proBussiReviewMeeting/bussiMeetingStatistics', params).then(function(rs) {
var rs = rs.data;
self.list = rs;
Vue.nextTick(function () {
// DOM 更新了
self.showChart(rs);
})
if(typeof callback === "function") {
callback();
}
}).catch(function(error) {
if(typeof callback === "function") {
callback();
}
m.toast("网络异常,请重新试试");
})
},
showChart: function(list) {
if(list.length >6){
list = list.slice(0,6);
}
var listLabel = [];
var listValue1 = [];
var listValue2 = [];
list.forEach(function(e){
listLabel.push(e.meetingDateStr);
listValue1.push(e.bussiMeetingCount);
listValue2.push(e.itemCount);
});
var option = {
color: ['#3398DB'],
tooltip : {
trigger: 'axis',
axisPointer : { // 坐标轴指示器,坐标轴触发有效
type : 'shadow' // 默认为直线,可选为:'line' | 'shadow'
}
},
legend:{
},
grid: {
left: '3%',
right: '4%',
bottom: '3%',
containLabel: true
},
xAxis : [
{
type : 'category',
data :listLabel,
//data :["aa","b"],
axisTick: {
alignWithLabel: true
},
/* ,
axisLabel: {
interval:0,
//rotate:40,
formatter:function(value){
return value.split("-").join("\n");
}
} */
}
],
yAxis : [
{
type: 'value',
scale: true,
name:'评审会次数',
min: function(value){
return value.min;
},
max: function(value){
return value.max;
}
},
{
type: 'value',
scale: true,
name:'议案数',
min: function(value){
return value.min;
},
max: function(value){
return value.max;
},
offset:-5
}
],
series : [
{
name:'评审会次数',
type:'bar',
//barWidth: '60%',
data:listValue1
},
{
name:'议案数',
type:'line',
yAxisIndex:1,
//barWidth: '60%',
data:listValue2
}
]
};
var chart1 = echarts.init(document.getElementById('busi-chart'),'light');
//基于准备好的dom,初始化echarts实例
chart1.setOption(option, true);
},
loadFirstData: function() {
var self = this;
if(this.isFirstLoad) {
var waiting = plus.nativeUI.showWaiting('加载中...', {
back: 'transmit'
});
this.loadStatData(function() {
self.isFirstLoad = false;
waiting.close();
});
}
},
doLoadData: function() {
var self = this;
var waiting = plus.nativeUI.showWaiting('加载中...', {
back: 'transmit'
});
this.loadStatData(function() {
waiting.close();
});
},
openBussiReviewMeetingList: function(date) {
m.openWindow({
url: '../../bussi-review-meeting-list/html/bussi-review-meeting-list.html',
id: 'bussi-review-meeting-list',
styles: {
},
extras: {
'date': date
},
show: {
autoShow: true //页面loaded事件发生后自动显示,默认为true
},
waiting: {
autoShow: true, //自动显示等待框,默认为true
title: '正在加载...' //等待对话框上显示的提示内容
}
});
}
},
events:{
loadBusiStatEevnt:function(){
this.loadFirstData();
}
}/* ,
activate: function (done) {
var self = this
debugger;
} */
});
return cp1;
})
联系方式
[QQ]
240973924