提交 af0fef44 authored 作者: yueweilu's avatar yueweilu

类型判断

上级 03a0c132
......@@ -288,11 +288,23 @@ class _ReadPageState extends State<ReadPage> {
controller.addJavaScriptHandler(handlerName: 'offlineDelNoteCallBack', callback: (args){
Console.log('删除笔记回调------------------------------------------${args[0]}');
Map<String,dynamic> data = args[0];
int notesId = data['notes_id'];
int notesId = 0;
if (data['notes_id'].runtimeType == int) {
notesId = data['notes_id'];
}
else if (data['notes_id'].runtimeType == String){
notesId = int.parse(data['notes_id']);
}
int id = 0;
if(data.keys.contains('id')){
// id = data['id'];
if (data['id'].runtimeType == int) {
id = data['id'];
}
else if (data['id'].runtimeType == String){
id = int.parse(data['id']);
}
}
readController.delLocalNote(noteId: notesId,id: id);
});
......@@ -302,11 +314,22 @@ class _ReadPageState extends State<ReadPage> {
// int id = 0;
// Map<String, dynamic> data = {};
Map<String,dynamic> data = args[0];
int notesId = data['notes_id'];
int notesId = 0;
if (data['notes_id'].runtimeType == int) {
notesId = data['notes_id'];
}
else if (data['notes_id'].runtimeType == String){
notesId = int.parse(data['notes_id']);
}
int id = 0;
if(data.keys.contains('id')){
if (data['id'].runtimeType == int) {
id = data['id'];
}
else if (data['id'].runtimeType == String){
id = int.parse(data['id']);
}
}
readController.updateLocalNote(notesId: notesId,id:id, data: data);
});
},
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论