Skip to content

Commit d91e672

Browse files
committed
增加wkwebview下xhr的判断
1 parent ff74c90 commit d91e672

File tree

10 files changed

+95
-21
lines changed

10 files changed

+95
-21
lines changed

dist/css/mui.css

+38-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* =====================================================
3-
* Mui v3.7.2 (http://dev.dcloud.net.cn/mui)
3+
* Mui v3.7.3 (http://dev.dcloud.net.cn/mui)
44
* =====================================================
55
*/
66

@@ -17,6 +17,43 @@ body
1717
margin: 0;
1818
}
1919

20+
body::after
21+
{
22+
position: fixed;
23+
top: -1000px;
24+
left: -1000px;
25+
26+
content: '';
27+
-webkit-animation: shadow-preload .1s;
28+
animation: shadow-preload .1s;
29+
-webkit-animation-delay: 3s;
30+
animation-delay: 3s;
31+
}
32+
33+
@-webkit-keyframes shadow-preload
34+
{
35+
0%
36+
{
37+
background-image: url(https://cdn.dcloud.net.cn/img/mui-shadow-grey.png);
38+
}
39+
40+
100%
41+
{
42+
background-image: url(https://cdn.dcloud.net.cn/img/mui-shadow-grey.png);
43+
}
44+
}
45+
@keyframes shadow-preload
46+
{
47+
0%
48+
{
49+
background-image: url(https://cdn.dcloud.net.cn/img/mui-shadow-grey.png);
50+
}
51+
52+
100%
53+
{
54+
background-image: url(https://cdn.dcloud.net.cn/img/mui-shadow-grey.png);
55+
}
56+
}
2057
article,
2158
aside,
2259
details,

dist/css/mui.min.css

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/mui.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* =====================================================
3-
* Mui v3.7.2 (http://dev.dcloud.net.cn/mui)
3+
* Mui v3.7.3 (http://dev.dcloud.net.cn/mui)
44
* =====================================================
55
*/
66
/**
@@ -3163,8 +3163,12 @@ Function.prototype.bind = Function.prototype.bind || function(to) {
31633163
var setHeader = function(name, value) {
31643164
headers[name.toLowerCase()] = [name, value];
31653165
};
3166-
var protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol;
3166+
var protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol;
31673167
var xhr = settings.xhr(settings);
3168+
3169+
if(location.protocol === 'file:' && $.os.ios && window.webkit && window.webkit.messageHandlers && !(xhr instanceof plus.net.XMLHttpRequest)){
3170+
console.error("当前运行环境为WKWebview,需在plusReady事件触发后再调用mui.ajax,否则可能会执行失败或报Script error的错误")
3171+
}
31683172
var nativeSetHeader = xhr.setRequestHeader;
31693173
var abortTimeout;
31703174

dist/js/mui.min.js

+2-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/hello-mui/css/mui.min.css

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/hello-mui/js/mui.js

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*!
22
* =====================================================
3-
* Mui v3.7.2 (http://dev.dcloud.net.cn/mui)
3+
* Mui v3.7.3 (http://dev.dcloud.net.cn/mui)
44
* =====================================================
55
*/
66
/**
@@ -3163,8 +3163,12 @@ Function.prototype.bind = Function.prototype.bind || function(to) {
31633163
var setHeader = function(name, value) {
31643164
headers[name.toLowerCase()] = [name, value];
31653165
};
3166-
var protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol;
3166+
var protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol;
31673167
var xhr = settings.xhr(settings);
3168+
3169+
if(location.protocol === 'file:' && $.os.ios && window.webkit && window.webkit.messageHandlers && !(xhr instanceof plus.net.XMLHttpRequest)){
3170+
console.error("当前运行环境为WKWebview,需在plusReady事件触发后再调用mui.ajax,否则可能会执行失败或报Script error的错误")
3171+
}
31683172
var nativeSetHeader = xhr.setRequestHeader;
31693173
var abortTimeout;
31703174

examples/hello-mui/js/mui.min.js

+2-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

js/mui.ajax.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,12 @@
143143
var setHeader = function(name, value) {
144144
headers[name.toLowerCase()] = [name, value];
145145
};
146-
var protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol;
146+
var protocol = /^([\w-]+:)\/\//.test(settings.url) ? RegExp.$1 : window.location.protocol;
147147
var xhr = settings.xhr(settings);
148+
149+
if(location.protocol === 'file:' && $.os.ios && window.webkit && window.webkit.messageHandlers && !(xhr instanceof plus.net.XMLHttpRequest)){
150+
console.error("当前运行环境为WKWebview,需在plusReady事件触发后再调用mui.ajax,否则可能会执行失败或报Script error的错误")
151+
}
148152
var nativeSetHeader = xhr.setRequestHeader;
149153
var abortTimeout;
150154

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "mui",
33
"description": "最接近原生体验的高性能前端框架.",
4-
"version": "3.7.2",
4+
"version": "3.7.3",
55
"keywords": [
66
"css",
77
"fonts",

sass/normalize.scss

+31
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,37 @@ body {
2020
margin: 0;
2121
}
2222

23+
body::after {
24+
position: fixed;
25+
content: '';
26+
left: -1000px;
27+
top: -1000px;
28+
-webkit-animation: shadow-preload 0.1s;
29+
-webkit-animation-delay: 3s;
30+
animation: shadow-preload 0.1s;
31+
animation-delay: 3s;
32+
}
33+
34+
@-webkit-keyframes shadow-preload {
35+
0% {
36+
background-image: url(https://cdn.dcloud.net.cn/img/mui-shadow-grey.png);
37+
}
38+
39+
100% {
40+
background-image: url(https://cdn.dcloud.net.cn/img/mui-shadow-grey.png);
41+
}
42+
}
43+
44+
@keyframes shadow-preload {
45+
0% {
46+
background-image: url(https://cdn.dcloud.net.cn/img/mui-shadow-grey.png);
47+
}
48+
49+
100% {
50+
background-image: url(https://cdn.dcloud.net.cn/img/mui-shadow-grey.png);
51+
}
52+
}
53+
2354
// HTML5 display definitions
2455
// ==========================================================================
2556

0 commit comments

Comments
 (0)