怎么用dw第一次做網(wǎng)站關(guān)鍵詞優(yōu)化步驟簡(jiǎn)短
?介紹
服務(wù)卡片的布局和使用,其中卡片內(nèi)容顯示使用了一次開(kāi)發(fā),多端部署的能力實(shí)現(xiàn)多設(shè)備自適應(yīng)。
用到了卡片擴(kuò)展模塊接口,[@ohos.app.form.FormExtensionAbility]?。
卡片信息和狀態(tài)等相關(guān)類型和枚舉接口,[@ohos.app.form.formInfo]。
卡片數(shù)據(jù)綁定的能力接口[@ohos.app.form.formBindingData]。
效果預(yù)覽
主頁(yè) | 卡片 |
---|---|
| |
使用說(shuō)明
長(zhǎng)按示例應(yīng)用,等待出現(xiàn)服務(wù)卡片字樣,點(diǎn)擊后可左右滑動(dòng)選擇需要的卡片尺寸,添加到屏幕。
更多鴻蒙開(kāi)發(fā)應(yīng)用知識(shí)已更新gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md參考前往。
具體實(shí)現(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、初始化卡片:通過(guò)實(shí)現(xiàn)@ohos.app.form.FormExtensionAbility卡片操作類,在卡片對(duì)象首次被創(chuàng)建時(shí),初始化卡片綁定數(shù)據(jù)為空,并將卡片狀態(tài)設(shè)置為就緒狀態(tài)READY。 例如:onCreate(){ formBindingData.createFormBindingData({}) onAcquireFormState(want) { return formInfo.FormState.READY }。
3、配置卡片:用js編寫(xiě)相應(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"]}]}
最后呢,很多開(kāi)發(fā)朋友不知道需要學(xué)習(xí)那些鴻蒙技術(shù)?鴻蒙開(kāi)發(fā)崗位需要掌握那些核心技術(shù)點(diǎn)?為此鴻蒙的開(kāi)發(fā)學(xué)習(xí)必須要系統(tǒng)性的進(jìn)行。
而網(wǎng)上有關(guān)鴻蒙的開(kāi)發(fā)資料非常的少,假如你想學(xué)好鴻蒙的應(yīng)用開(kāi)發(fā)與系統(tǒng)底層開(kāi)發(fā)。你可以參考這份資料,少走很多彎路,節(jié)省沒(méi)必要的麻煩。由兩位前阿里高級(jí)研發(fā)工程師聯(lián)合打造的《鴻蒙NEXT星河版OpenHarmony開(kāi)發(fā)文檔》里面內(nèi)容包含了(ArkTS、ArkUI開(kāi)發(fā)組件、Stage模型、多端部署、分布式應(yīng)用開(kāi)發(fā)、音頻、視頻、WebGL、OpenHarmony多媒體技術(shù)、Napi組件、OpenHarmony內(nèi)核、Harmony南向開(kāi)發(fā)、鴻蒙項(xiàng)目實(shí)戰(zhàn)等等)鴻蒙(Harmony NEXT)技術(shù)知識(shí)點(diǎn)
如果你是一名Android、Java、前端等等開(kāi)發(fā)人員,想要轉(zhuǎn)入鴻蒙方向發(fā)展??梢?span style="color:#fe2c24;">直接領(lǐng)取這份資料輔助你的學(xué)習(xí)。下面是鴻蒙開(kāi)發(fā)的學(xué)習(xí)路線圖。
高清完整版請(qǐng)點(diǎn)擊→《鴻蒙NEXT星河版開(kāi)發(fā)學(xué)習(xí)文檔》
針對(duì)鴻蒙成長(zhǎng)路線打造的鴻蒙學(xué)習(xí)文檔。話不多說(shuō),我們直接看詳細(xì)資料鴻蒙(OpenHarmony )學(xué)習(xí)手冊(cè)(共計(jì)1236頁(yè))與鴻蒙(OpenHarmony )開(kāi)發(fā)入門(mén)教學(xué)視頻,幫助大家在技術(shù)的道路上更進(jìn)一步。
《鴻蒙 (OpenHarmony)開(kāi)發(fā)學(xué)習(xí)視頻》
《鴻蒙生態(tài)應(yīng)用開(kāi)發(fā)V2.0白皮書(shū)》
《鴻蒙 (OpenHarmony)開(kāi)發(fā)基礎(chǔ)到實(shí)戰(zhàn)手冊(cè)》
獲取這份鴻蒙星河版學(xué)習(xí)資料,請(qǐng)點(diǎn)擊→《鴻蒙NEXT星河版開(kāi)發(fā)學(xué)習(xí)文檔》
OpenHarmony北向、南向開(kāi)發(fā)環(huán)境搭建
《鴻蒙開(kāi)發(fā)基礎(chǔ)》
-
ArkTS語(yǔ)言
-
安裝DevEco Studio
-
運(yùn)用你的第一個(gè)ArkTS應(yīng)用
-
ArkUI聲明式UI開(kāi)發(fā)
-
.……
《鴻蒙開(kāi)發(fā)進(jìn)階》
-
Stage模型入門(mén)
-
網(wǎng)絡(luò)管理
-
數(shù)據(jù)管理
-
電話服務(wù)
-
分布式應(yīng)用開(kāi)發(fā)
-
通知與窗口管理
-
多媒體技術(shù)
-
安全技能
-
任務(wù)管理
-
WebGL
-
國(guó)際化開(kāi)發(fā)
-
應(yīng)用測(cè)試
-
DFX面向未來(lái)設(shè)計(jì)
-
鴻蒙系統(tǒng)移植和裁剪定制
-
……
《鴻蒙開(kāi)發(fā)實(shí)戰(zhàn)》
-
ArkTS實(shí)踐
-
UIAbility應(yīng)用
-
網(wǎng)絡(luò)案例
-
……
?獲取這份鴻蒙星河版學(xué)習(xí)資料,請(qǐng)點(diǎn)擊→《鴻蒙NEXT星河版開(kāi)發(fā)學(xué)習(xí)文檔》
總結(jié)
鴻蒙—作為國(guó)家主力推送的國(guó)產(chǎn)操作系統(tǒng)。部分的高校已經(jīng)取消了安卓課程,從而開(kāi)設(shè)鴻蒙課程;企業(yè)紛紛跟進(jìn)啟動(dòng)了鴻蒙研發(fā)。
并且鴻蒙是完全具備無(wú)與倫比的機(jī)遇和潛力的;預(yù)計(jì)到年底將有 5,000 款的應(yīng)用完成原生鴻蒙開(kāi)發(fā),未來(lái)將會(huì)支持 50 萬(wàn)款的應(yīng)用。那么這么多的應(yīng)用需要開(kāi)發(fā),也就意味著需要有更多的鴻蒙人才。鴻蒙開(kāi)發(fā)工程師也將會(huì)迎來(lái)爆發(fā)式的增長(zhǎng),學(xué)習(xí)鴻蒙勢(shì)在必行!