我尝试在我的应用程序中显示活动指示器.我activity.js用于活动指标.那个在浏览器和iPhone上工作得很好但是它不适用于Android设备.
我不知道为什么指标在Android设备中不起作用.
以下是我的活动指标示例代码:
function showIndicator() {
console.log("inside show indicator");
applyOverLay();
var showIndicator = document.createElement("div");
showIndicator.setAttribute("class", "activity-indicator");
document.body.appendChild(showIndicator);
$('.activity-indicator').activity({
width: 5,
space: 1,
length: 3,
color: '#fff'
});
}
function applyOverLay() {
var overlay = document.createElement("div");
overlay.setAttribute("id", "overlayAttr");
overlay.setAttribute("class", "overlay");
document.body.appendChild(overlay);
}
function hideindicator() {
$('.activity-indicator').activity(false);
setTimeout(function() { $(".activity-indicator").empty().remove(); }, 0);
setTimeout(function() { $(".overlay").empty().remove(); }, 0);
}
function loadhtmlpage() {
//location.href='#refillReminder';
$.mobile.changePage("#refillReminder");
showIndicator();
hideindicator();
}
style.css:
.activity-indicator {
padding: 10px;
position: absolute;
top: 50%;
left: 45%;
z-index: 1001;
}
Run Code Online (Sandbox Code Playgroud) 我只是尝试使用 react-native-web 为 ios、android 和 web 示例应用程序。在这里,我必须从服务器下载 pdf 文件,同时单击 showpdf 按钮,下载的文件也需要在 android 应用程序和 Windows 浏览器中打开。对于浏览器下载,我使用了以下代码
fetch('http://www.pdf995.com/samples/pdf.pdf',{
method: 'GET',
mode: 'no-cors',
responseType: 'blob', // important
headers: {
'Content-Type': 'application/json',
},})
.then(response => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', item.pdfFileName);
document.body.appendChild(link);
link.click();
this.setState({
pdf_url:url
});
Run Code Online (Sandbox Code Playgroud)
下载后我需要打开这个pdf文件。如果有人知道这一点,请帮助。谢谢。