怎么用dw第一次做網(wǎng)站關(guān)鍵詞優(yōu)化步驟簡短
?介紹
服務(wù)卡片的布局和使用,其中卡片內(nèi)容顯示使用了一次開發(fā),多端部署的能力實現(xiàn)多設(shè)備自適應(yīng)。
用到了卡片擴展模塊接口,[@ohos.app.form.FormExtensionAbility]?。
卡片信息和狀態(tài)等相關(guān)類型和枚舉接口,[@ohos.app.form.formInfo]。
卡片數(shù)據(jù)綁定的能力接口[@ohos.app.form.formBindingData]。
效果預(yù)覽
主頁 | 卡片 |
---|---|
| |
使用說明
長按示例應(yīng)用,等待出現(xiàn)服務(wù)卡片字樣,點擊后可左右滑動選擇需要的卡片尺寸,添加到屏幕。
更多鴻蒙開發(fā)應(yīng)用知識已更新gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md參考前往。
具體實現(xiàn)
?1、在module.json5文件添加拓展能力,類型為卡片,并設(shè)置卡片入口srcEntrance和卡片元數(shù)據(jù)metadata。[源碼參考] 。
/** Copyright (c) 2023 Huawei Device Co., Ltd.* Licensed under the Apache License, Version 2.0 (the "License");* you may not use this file except in compliance with the License.* You may obtain a copy of the License at** http://www.apache.org/licenses/LICENSE-2.0** Unless required by applicable law or agreed to in writing, software* distributed under the License is distributed on an "AS IS" BASIS,* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.* See the License for the specific language governing permissions and* limitations under the License.*/{"module": {"name": "entry","type": "entry","description": "$string:module_desc","mainElement": "EntryAbility","deviceTypes": ["default","tablet"],"deliveryWithInstall": true,"installationFree": false,"pages": "$profile:main_pages","abilities": [{"name": "EntryAbility","srcEntrance": "./ets/entryability/EntryAbility.ets","description": "$string:EntryAbility_desc","icon": "$media:icon","label": "$string:EntryAbility_label","startWindowIcon": "$media:icon","startWindowBackground": "$color:start_window_background","visible": true,"skills": [{"entities": ["entity.system.home"],"actions": ["action.system.home"]}]}],"extensionAbilities": [{"name": "EntryFormAbility","srcEntrance": "./ets/entryformability/EntryFormAbility.ets","label": "$string:EntryFormAbility_label","description": "$string:EntryFormAbility_desc","type": "form","metadata": [{"name": "ohos.extension.form","resource": "$profile:form_config"}]}]}}
例如:"metadata": [ { "name": "ohos.extension.form", "resource": "$profile:form_config" }。
2、初始化卡片:通過實現(xiàn)@ohos.app.form.FormExtensionAbility卡片操作類,在卡片對象首次被創(chuàng)建時,初始化卡片綁定數(shù)據(jù)為空,并將卡片狀態(tài)設(shè)置為就緒狀態(tài)READY。 例如:onCreate(){ formBindingData.createFormBindingData({}) onAcquireFormState(want) { return formInfo.FormState.READY }。
3、配置卡片:用js編寫相應(yīng)的卡片,將卡片配置到resources/base/profile/form_config,?[源碼參考]
{"forms": [{"name": "complex","description": "This is a service widget.","src": "./js/complex/pages/index/index","window": {"designWidth": 720,"autoDesignWidth": true},"colorMode": "auto","isDefault": true,"updateEnabled": true,"scheduledUpdateTime": "10:30","updateDuration": 1,"defaultDimension": "2*2","supportDimensions": ["2*2","4*4"]},{"name": "test","description": "This is a service widget.","src": "./js/test/pages/index/index","window": {"designWidth": 720,"autoDesignWidth": true},"colorMode": "auto","isDefault": false,"updateEnabled": true,"scheduledUpdateTime": "10:30","updateDuration": 1,"defaultDimension": "2*2","supportDimensions": ["2*2"]},{"name": "immersive","description": "This is a service widget.","src": "./js/immersive/pages/index/index","window": {"designWidth": 720,"autoDesignWidth": true},"colorMode": "auto","isDefault": false,"updateEnabled": true,"scheduledUpdateTime": "10:30","updateDuration": 1,"defaultDimension": "2*2","supportDimensions": ["2*2"]},{"name": "grid","description": "This is a service widget.","src": "./js/grid/pages/index/index","window": {"designWidth": 720,"autoDesignWidth": true},"colorMode": "auto","isDefault": false,"updateEnabled": true,"scheduledUpdateTime": "10:30","updateDuration": 1,"defaultDimension": "2*2","supportDimensions": ["2*2"]},{"name": "imgText","description": "This is a service widget.","src": "./js/imgText/pages/index/index","window": {"designWidth": 720,"autoDesignWidth": true},"colorMode": "auto","isDefault": false,"updateEnabled": true,"scheduledUpdateTime": "10:30","updateDuration": 1,"defaultDimension": "2*2","supportDimensions": ["2*2","2*4"]}]}
最后呢,很多開發(fā)朋友不知道需要學(xué)習(xí)那些鴻蒙技術(shù)?鴻蒙開發(fā)崗位需要掌握那些核心技術(shù)點?為此鴻蒙的開發(fā)學(xué)習(xí)必須要系統(tǒng)性的進行。
而網(wǎng)上有關(guān)鴻蒙的開發(fā)資料非常的少,假如你想學(xué)好鴻蒙的應(yīng)用開發(fā)與系統(tǒng)底層開發(fā)。你可以參考這份資料,少走很多彎路,節(jié)省沒必要的麻煩。由兩位前阿里高級研發(fā)工程師聯(lián)合打造的《鴻蒙NEXT星河版OpenHarmony開發(fā)文檔》里面內(nèi)容包含了(ArkTS、ArkUI開發(fā)組件、Stage模型、多端部署、分布式應(yīng)用開發(fā)、音頻、視頻、WebGL、OpenHarmony多媒體技術(shù)、Napi組件、OpenHarmony內(nèi)核、Harmony南向開發(fā)、鴻蒙項目實戰(zhàn)等等)鴻蒙(Harmony NEXT)技術(shù)知識點
如果你是一名Android、Java、前端等等開發(fā)人員,想要轉(zhuǎn)入鴻蒙方向發(fā)展??梢?span style="color:#fe2c24;">直接領(lǐng)取這份資料輔助你的學(xué)習(xí)。下面是鴻蒙開發(fā)的學(xué)習(xí)路線圖。
高清完整版請點擊→《鴻蒙NEXT星河版開發(fā)學(xué)習(xí)文檔》
針對鴻蒙成長路線打造的鴻蒙學(xué)習(xí)文檔。話不多說,我們直接看詳細(xì)資料鴻蒙(OpenHarmony )學(xué)習(xí)手冊(共計1236頁)與鴻蒙(OpenHarmony )開發(fā)入門教學(xué)視頻,幫助大家在技術(shù)的道路上更進一步。
《鴻蒙 (OpenHarmony)開發(fā)學(xué)習(xí)視頻》
《鴻蒙生態(tài)應(yīng)用開發(fā)V2.0白皮書》
《鴻蒙 (OpenHarmony)開發(fā)基礎(chǔ)到實戰(zhàn)手冊》
獲取這份鴻蒙星河版學(xué)習(xí)資料,請點擊→《鴻蒙NEXT星河版開發(fā)學(xué)習(xí)文檔》
OpenHarmony北向、南向開發(fā)環(huán)境搭建
《鴻蒙開發(fā)基礎(chǔ)》
-
ArkTS語言
-
安裝DevEco Studio
-
運用你的第一個ArkTS應(yīng)用
-
ArkUI聲明式UI開發(fā)
-
.……
《鴻蒙開發(fā)進階》
-
Stage模型入門
-
網(wǎng)絡(luò)管理
-
數(shù)據(jù)管理
-
電話服務(wù)
-
分布式應(yīng)用開發(fā)
-
通知與窗口管理
-
多媒體技術(shù)
-
安全技能
-
任務(wù)管理
-
WebGL
-
國際化開發(fā)
-
應(yīng)用測試
-
DFX面向未來設(shè)計
-
鴻蒙系統(tǒng)移植和裁剪定制
-
……
《鴻蒙開發(fā)實戰(zhàn)》
-
ArkTS實踐
-
UIAbility應(yīng)用
-
網(wǎng)絡(luò)案例
-
……
?獲取這份鴻蒙星河版學(xué)習(xí)資料,請點擊→《鴻蒙NEXT星河版開發(fā)學(xué)習(xí)文檔》
總結(jié)
鴻蒙—作為國家主力推送的國產(chǎn)操作系統(tǒng)。部分的高校已經(jīng)取消了安卓課程,從而開設(shè)鴻蒙課程;企業(yè)紛紛跟進啟動了鴻蒙研發(fā)。
并且鴻蒙是完全具備無與倫比的機遇和潛力的;預(yù)計到年底將有 5,000 款的應(yīng)用完成原生鴻蒙開發(fā),未來將會支持 50 萬款的應(yīng)用。那么這么多的應(yīng)用需要開發(fā),也就意味著需要有更多的鴻蒙人才。鴻蒙開發(fā)工程師也將會迎來爆發(fā)式的增長,學(xué)習(xí)鴻蒙勢在必行!