我正在尝试将下面的 JSON 转换为 Excel,我正在使用XLSX,它将我的 JSON 转换为 Excel,但是,dailyPointsArray 的嵌套数组在转换为 Excel 后为空。
尝试过代码
const XLSX = require("xlsx");
const workSheet = XLSX.utils.json_to_sheet(attendanceData);
const workBook = XLSX.utils.book_new();
XLSX.utils.book_append_sheet(workBook, workSheet, "attendance");
XLSX.write(workBook, { bookType: "xlsx", type: "buffer" });
XLSX.write(workBook, { bookType: "xlsx", type: "binary" });
XLSX.writeFile(workBook,"newExcel.xlsx");
Run Code Online (Sandbox Code Playgroud)
attendanceData:[
{
workerId: '1230',
workerFullName: 'A',
workerDepartment: 'INFORMATION TECHNOLOGY',
workerDesignation: 'ASSISTANT MANAGER',
Location: 'locationA',
dailyPointsArray: [
{
inTime: '-',
Date: '23/03/2022',
outTime: '-',
Points: null,
createdAs: 'ABSENT'
},
{
inTime: '-',
Date: '24/03/2022',
outTime: '-',
Points: null, …Run Code Online (Sandbox Code Playgroud) 我是 React Native 的新手,我正在使用 expo,如果应用程序在后台或被杀死,我试图获取用户位置。我使用了任务管理器,但我不知道为什么它不起作用。当应用程序在前台运行时,它工作正常,但是当应用程序在后台或被杀死时,它不会给我位置。
我正在使用世博地点中的位置
const LOCATION_TASK_NAME = "background-location-task";
componentDidMount = async () => {
this._getLocationAsync();
};
_getLocationAsync = async () => {
try {
//ask permission of user for location
let { status } = await Permissions.askAsync(Permissions.LOCATION);
//check the location setting
const permissionStaatus = await Location.getProviderStatusAsync();
const newStatus = permissionStaatus.locationServicesEnabled;
//if phone location is disabled
if (!newStatus) {
const { navigation } = this.props;
Alert.alert(
"Error",
"Please Turn On you'r Location",
[
{
text: "OK",
onPress: this.openSetting
} …Run Code Online (Sandbox Code Playgroud)