In recent years, uniapp as a cross-platform development framework has been favored by more and more developers and enterprises. However, problems that arise after uniapp is packaged and compiled also cause many developers a headache. Among them, one of the more common problems is that the css address of uniapp packaged and compiled does not have quotation marks. So, what is the reason for this problem? And how to solve it? Let’s discuss one by one below.
Regarding this issue, first of all, we need to make it clear that uniapp is ultimately packaged into different types of applications such as WeChat applet, Alipay applet, and APP. In these applications, the overall css writing Prefer a modular programming style, that is to say, CSS styles under different modules will be isolated from each other. Therefore, when referencing the css file under this module in any module, you can omit the quotation marks.
However, if you use require to reference styles and images in the uniapp source code, an error will be reported when packaging. Therefore, developers need to pay special attention when referencing css files. If you reference css under other modules in different modules, you must add quotation marks.
At the same time, in order to solve this problem, we can also adopt some practical methods. Among them, the easiest way is to install an eslint plug-in for uniapp to detect syntax errors in real time when writing code. Among them, for the problem that the css address does not have quotation marks, the eslint plug-in will give corresponding prompts to help developers avoid this problem.
In addition, we can also avoid problems by manually adding quotation marks to the css file. Of course, this method may be a little time-consuming and labor-intensive, but it is a safer method.
To sum up, although the problem of uniapp packaged and compiled css addresses without quotation marks is common, it is not inevitable. As long as we pay attention to details and write strictly in accordance with coding standards, we can effectively avoid such problems.
The above is the detailed content of How to solve the problem that the css address of uniapp packaged and compiled does not have quotation marks?. For more information, please follow other related articles on the PHP Chinese website!