当前位置:网站首页>Huawei Hongmeng development lesson 4
Huawei Hongmeng development lesson 4
2022-06-25 04:42:00 【Students who don't want to be bald】
Learning documents :
One 、web Components
A component that displays the contents of a web page
constraint
A page only supports one web Components , It will be displayed in full screen , If there are other components in the page , Will be web Component overlay ,web Components do not follow transition animation
Child components
I won't support it .
attribute
Only the following properties are supported :
name | type | The default value is | Required | describe |
|---|---|---|---|---|
src | string | - | no | Set the address of the web page to be displayed , The domain name of the web address must be https The agreement has been made and passed through ICP Keep on record . |
id | string | - | no | Unique identification of the component . |
style
Generic style settings are not supported .
event
Only the following events are supported :
name | Parameters | describe |
|---|---|---|
pagestart | {url: string} | Triggered when a web page is loaded |
pagefinish | {url: string} | Triggered at the end of web page loading |
error | {url: string, errorCode: number, description: string} | Triggered when there is an error loading a web page or when there is an error opening a web page |
Method
Only the following methods are supported :
name | Parameters | describe |
|---|---|---|
reload | - | Reload page |
Example
<!-- xxx.hml -->
<div class="container">
<button onclick="reloadWeb">click to reload</button>
<web src = "https://www.example.com" onpagestart="pagestart" onpagefinish="pagefinish" onerror="error"></web>
</div>// xxx.js
import router from '@system.router'
export default {
reloadWeb() {
this.$element('web').reload()
},
pagestart: function (e) {
console.info('pagestart: ' + e.url);
},
pagefinish: function (e) {
console.info('pagefinish: ' + e.url);
},
error: function (e) {
console.info('pageError url:' + e.url);
console.info('pageError errorCode:' + e.errorCode);
console.info('pageError description:' + e.description);
}
}// xxx.js
import router from '@system.router'
export default {
reloadWeb() {
this.$element('web').reload()
},
pagestart: function (e) {
console.info('pagestart: ' + e.url);
},
pagefinish: function (e) {
console.info('pagefinish: ' + e.url);
},
error: function (e) {
console.info('pageError url:' + e.url);
console.info('pageError errorCode:' + e.errorCode);
console.info('pageError description:' + e.description);
}
}Two 、carmera Components
Camera assembly , Provide preview 、 Photo function .
Child components
I won't support it .
attribute
Except support General properties Outside , The following styles are also supported :
name | type | The default value is | Required | describe |
|---|---|---|---|---|
flash | string | off | no | The flash , The value is on、off、torch( Flashlight always on mode ) |
deviceposition | string | back | no | Before or after , The value is front、back. |
explain
Rendering properties are not currently supported if、show and for.
style
Only the following styles are supported :
name | type | The default value is | Required | describe |
|---|---|---|---|---|
width | <length> | <percentage> | - | no | Set the width of the component itself . By default, the width required for the content of the element itself is used . explain camera Dynamic modification of component width and height is not supported . |
height | <length> | <percentage> | - | no | Set the height of the component itself . By default, the height required for the content of the element itself is used . |
[left|top] | <length> | - | no | left|top Need to cooperate with position Patterns use , To determine the offset position of the element .
|
event
Except support General events Outside , The following events are also supported :
name | Parameters | describe |
|---|---|---|
error | - | Trigger when the user is not allowed to use the camera . |
Method
Only the following methods are supported :
name | Parameters | describe |
|---|---|---|
takePhoto | Take photos , Support to set picture quality . |
Parameters | type | Required | The default value is | describe |
|---|---|---|---|---|
quality | string | yes | normal | Picture quality , Possible values are :high、normal、low. |
success | Function | no | - | Interface calls the successful callback function . Return to picture uri. |
fail | Function | no | - | Interface call failed callback function . |
complete | Function | no | - | The callback function at the end of the interface call . |
Example
<!-- xxx.hml-->
<div class="container">
<camera flash="on" deviceposition="back" @error="cameraError">
</camera>
</div>/* xxx.css */
.container {
display: flex;
justify-content: center;
align-items: center;
}
camera{
width: 300px;
height: 300px;
}//xxx.js
import prompt from '@system.prompt';
export default {
data: {
title: 'World'
},
cameraError(){
prompt.showToast({
message: " privilege grant failed !"
});
}
}边栏推荐
- LabVIEW development gas regulator
- CTF_ Web: Advanced questions of attack and defense world expert zone WP (9-14)
- GBASE 8s的数据视图
- 冰冰学习笔记:循环队列的实现
- Introduction to the isolation level of gbase 8s
- GBASE 8s存储过程执行和删除
- Unity Quad culls shaders with back faces and transparent parts
- Retrofit 源码分析
- GBASE 8s存儲過程語法結構
- CTF_ Web: Advanced questions of attack and defense world expert zone WP (15-18)
猜你喜欢

Unity Quad culls shaders with back faces and transparent parts

哪个编程语言实现hello world最烦琐?

Easyrecovery15 very easy to use computer data recovery software

CTF_ Web: advanced problem WP (5-8) of attack and defense world expert zone

Office macro virus bounce shell experiment

Concat() in JS

执行SQL响应比较慢,你有哪些排查思路?

【FLink】access closed classloader classloader.check-leaked-classloader

PHP extracts and analyzes table contents, and collects bidding information

2.0SpingMVC使用RESTful
随机推荐
Gbase 8s memory management
Mongodb cluster
PostgreSQL database Wal - RM_ HEAP_ ID logging action
OpenSea PHP开发包
深度学习——几种学习类型
515. find the maximum value / Sword finger offer II 095 in each tree row Longest common subsequence
js中的concat()
LabVIEW开发气体调节器
Simple text analysis of malicious samples - Introduction
ThinkPHP is integrated with esaywechat. What's wrong with wechat payment callback without callback?
GBASE 8s的隔离级别介绍
Cannot import name 'escape' from 'jinja2' [solved successfully]
Upgrade PHP to php7 The impact of X (2), the obsolescence of mcrypt decryption
CTF_ Web: basic 12 questions WP of attack and defense world novice zone
高效的NoSQL数据库服务Amozon DynamoDB体验分享
JS call() and apply()
Excel exports data to SQL and pictures to folder through macro | VBA
【无标题】
Structure syntaxique des procédures stockées gbase 8S
2.0springmvc uses restful