Usage:

var(custom-property-name, value)
Copy the code
value describe
custom-property-name A necessity. The name of the custom property, which must start with –.
value Optional. Alternate value, used when the attribute does not exist.
  1. When defining a variable in global CSS, prefix the variable name with –. For example: – themeColor
  2. Var (–themeColor) when called elsewhere
/ / app. WXSS
page {
    --themeColor: #eb4450;
}

// index. WXSS
color: var(--themeColor);
Copy the code