General problem: When using uView in the Uniapp environment and publishing it to a mini program, due to strict specifications, my code looks very unappealing. Can you show me a better way to write it?
Description: When using uView in the Uniapp environment and publishing it to a mini program, it is necessary to strictly follow the API provided by the uView2 official website to write code. If a class=”title” is added, it will become invalid and will be automatically deleted during compilation.
Preliminary solution: I chose to add: v-deep app container {} to the outermost layer of CSS, and then use the uView2 tag name for the class name, similar to writing CSS code in the form of:. u-form {}. This allows me to write CSS freely without being restricted by the API provided.
Problem: This writing method will fail when there are custom encapsulated sub components, such as custom tabbars. Explanation: If a part of the code is written in another file and imported into the main file through components, it will cause the method I used above to fail.
Summary: At the very least, it can solve the requirement of writing CSS arbitrarily when customizing child components. At present, no suitable method has been found
user26754509 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.