function _ajax(url
){
var promise
= new Promise(function(resolve
,reject
){
var XHR = XMLHttpRequest
? new XMLHttpRequest() ? new Window.ActiveXObject('Microsoft.XMLHTTP');
XHR.onreadystatechange = function(){
if(XHR.readyState
== 4){
if((XHR.status
>= 200 && XHR.status
<300 ) || XHR.status
== 304){
try{
var response
= JSON.parse(XHR.responseText
);
resolve(response
)
}catch(e
){
reject(e
)
}
}else{
reject(new Error("request error:"+XHR.statusText
))
}
}
}
XHR.open('GET',url
,true);
XHR.send();
})
return promise
;
}
_ajax(url
).then((res
)=>{console
.log(res
)})
css使用伪类after在每个标签后面增加图标 比如筛选的每个选项 选中时候末尾变成勾子图标
```css
.filter
-panel
.active
::after
{
content
:'';
width
:40rpx
;
height
:40rpx
;
float
:right
;
margin
-top
:20rpx
;
background
-repeat
:no
-repeat
;
background
-size
: cover
;
background
-image
:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='256' height='256' viewBox='0 0 48 48' fill='rgba(36, 103, 241, 1)'><path d='M0 0h48v48H0z' fill='none'></path><path d='M18 32.34L9.66 24l-2.83 2.83L18 38l24-24-2.83-2.83z'></path></svg>");
}
转载请注明原文地址: https://mac.8miu.com/read-504297.html