harmony 鸿蒙Creating an ArkTS Widget
Creating an ArkTS Widget
You can create a widget in either of the following modes:
- When creating a project, select Application, and then right-click a module folder and choose New > Service Widget to create a widget.
- When creating a project, select Atomic Service, and then right-click a module folder and choose New > Service Widget to create a widget.
NOTE
The UI may be different in DevEco Studio of a different version.
To create an ArkTS widget in an existing project, perform the following steps:
Right-click a module folder and choose New > Service Widget.
> NOTE > > For a project developed using API version 10 or later based on the stage model, you can create a dynamic or static widget from the Service Widget menu. You can also change the widget type by setting the isDynamic parameter in the form_config.json file of the widget. If isDynamic is left unspecified or set to true, the widget is a dynamic widget. If isDynamic is set to false, the widget is a static widget.
Select a widget template based on the actual service scenario.
- Set Language to ArkTS and click Finish.
You are advised to name the widget based on the actual scenario. After an ArkTS widget is created, the following widget-related files are automatically added to the project directory: EntryFormAbility.ets (widget lifecycle management file), WidgetCard.ets (widget page file), and form_config.json (widget configuration file).
你可能感兴趣的鸿蒙文章
harmony 鸿蒙Configuring Widget Configuration Files
harmony 鸿蒙Updating Widget Content by Widget Host (for System Applications Only)
harmony 鸿蒙Launching the UIAbility of the Widget Provider in the Background Through the call Event
harmony 鸿蒙Overview of ArkTs Widget Page Editing Interaction
harmony 鸿蒙Editing and Updating the Widget Content
harmony 鸿蒙Updating Widget Content Through the message Event
harmony 鸿蒙Widget Event Capability Overview
harmony 鸿蒙Launching the UIAbility of the Widget Provider Through the router Event
harmony 鸿蒙Updating Widget Content Through the router or call Event
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦