我无法在移动浏览器上运行javascript代码,我不知道为什么,在台式机上运行得还不错,但是当我尝试在移动浏览器上打开时,它找不到我的变量或我的职能职能。我正在设置值的对象用法是我之前创建的全局对象。how it's shown on my phone how it's shown on my desktop browser
class UsarioDAO{
static async trazDadosUsuario(id){
const dados = await
firebase.database().ref("usuarios/"+id).once("value");
usuario.setUsuarioId(dados.val().usuarioId);
usuario.setNome(dados.val().nome);
usuario.setPais(dados.val().pais);
usuario.setFoto(dados.val().foto);
usuario.setEmail(dados.val().email);
usuario.setFotoProvedor(dados.val().fotoProvedor);
usuario.setCaminho(dados.val().caminho);
usuario.setToken(dados.val().token);
usuario.setUsuarioGostos(dados.val().gostos);
pais = dados.val().pais;
return new Promise((resolve,reject)=>resolve("resolvido"));
}
}
class EventoDAO{
static async listar(id){
let eventos = [];
const eventosRef = firebase.database().ref("eventos/"+pais);
try{
const user = await userRef.once("value");
const categorias = await eventosRef.once("value");
categorias.forEach(auxEvento=>{
const evento = new Evento();
evento.setId(auxEventos.val().id);
evento.setTitulo(auxEventos.val().titulo);
evento.setDescricao(auxEventos.val().descricao);
evento.setHorario(auxEventos.val().horario);
eventos.push(evento);
});
return new Promise((resolve,reject)=>resolve(eventos));
}catch(erro){
console.log(erro);
Notificacao.erro(erro);
}
}
}
try{
await UsuarioDAO.trazDadosUsuario(user.uid,null);
const eventos = await EventoDAO.listar(user.uid);
escondeLoading()
eventos.forEach(evento=>{
criaLista(evento,"todos");
});
defineLanguage();
if(navigator.language.split("-").shift()=="en"){
$(".btn-success").css("padding","30px 30px");
$(".btn-primary").css("padding","30px 8px");
}
}catch(erro){
console.log(erro);
Notificacao.erro(erro);
}
}
答案 0 :(得分:0)
我认为我“解决了”这个问题,似乎与浏览器版本兼容,我在android手机上运行chrome并成功了,但是当我在iphone chrome上运行时却不行。还有一种叫做babel的东西,它可以在旧版本中重写您的javascript以在旧版本的浏览器上运行,但是仍然不适用于我