Get the App
SLTechnology News&Howtos  ›  Development  › 

How to solve the problem of overwriting style classes in css files and undefined variables in js files

Shulou Source: shulou.com Published: 2022-06-03 13:45:01 10月05日 Update

This article introduces how to solve the problem that the style classes in the css file are overwritten and the variables in the js file are not defined. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

The cause of the problem:

Why?

Because when invoking the css style of component W, we wrote the css style A Magi Ext component with its own css style B Magi A, which we put in with cls:'A'. So which kind of W is repeated in two styles?

It depends on the order in which css stylesheets are introduced. If you first introduce what you write, and then introduce what comes with Ext, the browser will read the css style written by itself first, and then read the style that comes with Ext. As a result, our own css style was overwritten.

Solution:

That's right.

Problem with undefined variables in js file

Problem description:

ReaderManageMentData.js

ReaderManageMentFunction.js

Html

Results:

Note: filterButtonArray is also a variable parameter defined in the readerManageMentData.js file, and it is also called in readerManageMentFunction.js, resulting in an error.

Solution:

A.js file (readerManageMentData.js)

B.js file (readerManageMentFunction.js)

Html file

That's the right order. For example, if a js file like this calls js files, it is necessary to introduce them in the same html and then you can use them directly. Instead of B.js calling page data in A.js, you can add A.js file code to B.js.

On how to solve the css file style classes are overwritten and js file variables are not defined to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Tags: Files styles problems variables results right content more components order help yes no two code interests methods reasons parameters guys Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Redmi macOS Huawei NVidia