当前位置:网站首页>Openharmony notes ----------- (I)

Openharmony notes ----------- (I)

2022-06-13 07:45:00 Maruko_ four hundred and twenty-eight

1.DevEco Studio Development environment construction

JavaScript Project development depends on Node.js Environmental Science , Download link :

Node.js

Special for Hongmeng system IDE development environment 「 DevEco Studio 」, Download link :

 HUAWEI DevEco Studio and SDK Download and upgrade | HarmonyOS developer

2.Hello Word Application experience

  • First step : After the application starts , Prompts whether to create a starter script , Convenient for subsequent template selection .

  • The second step : Use Huawei cloud npm Package management tools .

  • The third step : establish or Import the project .

  • Step four : Select project type and template .

    In order to meet the development needs of applications running on multiple devices ,DevEco Studio 2.1 Release On the basis of the original single equipment engineering template , Added 11 A cross equipment engineering template . According to the project guide , Select the template and equipment type in turn , Easily create cross device engineering , Automatically generate sample code and related resources .

  • Step five : Create an engineering project .

  • Step six : Check and close development tips .

  • Step seven : The project automatically downloads the corresponding dependencies and files , In this step, if you click run directly, there will be an error prompt .

  • Step eight : stay DevEco Studio menu bar , Click on Tools > SDK Manager Configure the corresponding SDK edition .

  • Step nine : Click on the top right corner sign in Log in to Huawei account , Please enter the user name and password of Huawei account with real name authentication to login , After successful login in the web page , Complete authorization .

  • Step 10 : Enter into src/main/js/default/pages/index page , open view -> Tool Windows -> Previewer To preview .

  • Step 11 : Get into Tools -> Devices Manager See the simulator management page , In this step, you must log in to a Huawei account with real name authentication , You can select the corresponding device , Then start the device .

  • The twelfth step : After starting the device , Click again on the Green operation button , You can run the project on the simulation device .

ps: stay Views You can quickly set the editor theme , And corresponding development settings  

3.JS Module development directory

The files in the directory structure are classified as follows :

  • .hml At the end of the HML Template file , This file is used to describe the file layout structure of the current page .
  • .css At the end of the CSS The style file , This file is used to describe the page style .
  • .js At the end of the JS file , This file is used to handle the interaction between the page and the user .

The role of each folder :

  • app.js Files are used for global JavaScript Logic and application lifecycle management .
  • pages The directory is used to store all component pages .
  • common Directory is used to store public resource files , such as : Media resources and JS file .
  • i18n The directory is used to configure the content of resources in different language scenes , such as : Apply text entry , Path... Pictures, etc , Be careful i18n Is the development retention folder , Cannot rename .

 4. Components

Hongmeng JS API Provides a complete introduction to , Let's check the official documents for details :  Components - The official introduction

原网站

版权声明
本文为[Maruko_ four hundred and twenty-eight]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/164/202206130737513435.html