导航时出现css / js的错误 [英] Bug with css/js when navigating

查看:81
本文介绍了导航时出现css / js的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到,当我在我的应用程序中导航时,顶级default.html获取并保留任何单个页面加载的每个css和js文件。  这导致问题,因为CSS在不同页面之间发生冲突。  这似乎是
就像一个bug。  如果不是,或者我需要调用一些额外的命令来完全卸载上一页,包括它的CSS / JS,那么该文档并不容易找到。

I've noticed that as I navigate around in my app, the top level default.html acquires and holds onto every single css and js file that any individual Page loads.  This is causing issues as CSS is colliding between different pages.  This seems like a bug.  If it isn't or I need to call some extra command that fully unloads the previous page, including its CSS/JS then that documentation hasn't been easy to find.

推荐答案

关键是在所有选择器前面加上分配给页面特定CSS文件中特定页面的ID或类。 

The key is to prefix all selectors with the id or class assigned to the particular page in your page specific CSS files. 

.main-page# btnFoo

.main-page #btnFoo

而不仅仅是

#btnFoo

#btnFoo


这篇关于导航时出现css / js的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆