当前位置:网站首页>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 !"
});
}
}边栏推荐
- i. Max development board learning record
- Value transfer between parent and child components of wechat applet
- Upgrade PHP to php7 The impact of X (I). The problem of session retention. Keep login
- GBase 8s 锁的分类
- Immutable学习之路----告别传统拷贝
- Code scanning payment flow chart of Alipay payment function developed by PHP
- 机器学习深度学习——向量化
- 高效的NoSQL数据库服务Amozon DynamoDB体验分享
- Cnpm: unable to load file c:\users\administrator\appdata\roaming\npm\cnpm PS1 because running scripts is prohibited on this system.
- CTF_ Web: Learn flask template injection (SSTI) from 0
猜你喜欢
随机推荐
OpenSea PHP开发包
CTF_ Web:8-bit controllable character getshell
分布式websocket搭建方案
Introduction to the isolation level of gbase 8s
Gbase 8s stored procedure execution and deletion
《牛客刷verilog》Part I Verilog快速入门
Data view for gbase 8s
GBASE 8s存储过程流程控制
为什么SQL语句命中索引比不命中索引要快?
哪个编程语言实现hello world最烦琐?
Codeforces Round #802 (Div. 2) C D
The consciousness of a programmer
Upgrade PHP to php7 The impact of X (2), the obsolescence of mcrypt decryption
Part I Verilog quick start
cannot import name ‘escape’ from ‘jinja2’【成功解决】
Paper notes: multi label learning ESMC (I don't understand it, but I haven't written it yet, so I'll put it here for a place temporarily)
Wechat likes to pay attention to the solution of invalid automatic reply
三角形类(构造与析构)
Gbase 8s parallel operation problem scenario description
GBASE 8s 索引B+树








