
# 设置宏
#### 使用说明
宏是站点级的变量，可在开发Widget时使用"${sm.*变量名*}"调用该变量。
#### 创建宏
1. 参考[如何进入经典开发环境](https://support.huaweicloud.com/usermanual-astrozero/astrozero_05_0003.html#astrozero_05_0003__section47067717379)中操作，进入经典版开发环境。
2. 在"首页 \> 项目 \> 我的应用"中，单击对应的应用，进入应用开发页面。
3. 在页面左下角，选择"页面设置"。
4. 在"宏"页签，单击"新建站点宏"。
5. 在"站点宏键"和"站点宏值"中，设置变量名和变量值。 
   例如，设置一个变量名为"Macro1"，取值为"hello world"。
   图1新建站点宏   
   ![](https://support.huaweicloud.com/usermanual-astrozero/zh-cn_image_0000001960124961.png "点击放大")
   
   
6. 设置完成后，单击页面上方的![](https://support.huaweicloud.com/usermanual-astrozero/zh-cn_image_0000001932886252.png)，保存设置。
 
#### 使用宏
宏创建完成后，可在开发Widget时使用该变量。
例如，在编辑某页面Widget时，将页面属性"Text Property"设置为"${sm.macro1}"，左侧该Widget"Text Property"属性值展示为"hello world"，即成功使用宏。
图2使用宏   
![](https://support.huaweicloud.com/usermanual-astrozero/zh-cn_image_0000001960284765.png "点击放大")
