This function is some color values provided by js inside uView. It can be used to modify element fonts, background colors and other scenarios through js. It is often used in various components of uView.
These color values are mounted in the array $u
under the object color
. For detailed descriptions of these color values, see Color
usage: If you use primary
color values, the method is:$u.color['primary']
Note : These color values called through JS can also be called through CSS, and they are equivalent. See Color for details
#themecolor _
There are 5 color values in this theme, namely primary
, error
, success
, info
,warning
export default{
onLoad() {
console.log(uni.$u.color['error']);
}
}
copy
#Text color
uView provides a total of four color values. For details, please see the component section. Color colors
are: mainColor
, contentColor
, tipsColor
, lightColor
, borderColor
(border color value)
export default{
onLoad() {
console.log(uni.$u.color['contentColor']);
}
}
copy
#background color
uView provides a light gray background color value, which is#f3f4f6
export default{
onLoad() {
console.log(uni.$u.color['bgColor']);
}
}