Intelligent Assistant
Chat with our virtual assistant to get answers promptly.
Adds buttons, which can be triggered with a sliding gesture, under or outside a view.
Item | Description |
|---|---|
Applicable devices | Mobile phones, tablets, Vision products, and telematics devices |
Applicable regions | Global |
The supported elements are the same as those of the div element.
In addition to general attributes, the attributes listed in the following table are supported.
Attribute | Type | Default Value | Mandatory | Description |
|---|---|---|---|---|
edge | left | right | right | No | On which side the button is placed. |
enableslide | boolean | true | No | Enables the slide. |
isopen | boolean | false | No | Indicates whether to enable the button area. |
layer | same | above | above | No | Hierarchical relationship between the button group and main body.
|
buttons | array | - | Yes | Button group. If there are more than three buttons, only the first three buttons are displayed. The total width is limited to no more than 2/3 of the width of the element operation container. |
buttons attributes
Attribute | Type | Default Value | Mandatory | Description |
|---|---|---|---|---|
id | string | - | Yes | Button ID, which is returned by the buttonClick event. |
buttonWidth | length | - | No | Button width. |
icon | uri | - | No | Button icon. |
iconWidth | length | 75px | No | Width of a button icon. |
iconHeight | length | 75px | No | Height of a button icon. |
iconBackgroundColor | color | #F2F2F2 | No | Color of the circular background area of the icon. This attribute takes effect only when backgroundType is set to icon. |
text | string | - | No | Text of the button. |
textSize | number | 15px | No | Font size. |
textColor | color | #000000 | No | Font color. |
backgroundColor | color | #F2F2F2 | No | Background color. |
backgroundType | fill | icon | fill | No | Background style.
NOTE If icon and text are both set, the icon is displayed in the upper center and text is displayed in the lower center. If only icon or text is set, the icon or text is displayed in the middle. |
secondaryConfirm | object | - | No | Re-confirmation status of a button. If it is empty, such status will not exist. NOTE If this attribute is set, the re-confirmation text is displayed when the button is tapped. The text background color is the same as the button background color. |
secondaryConfirm attributes
Attribute | Type | Default Value | Mandatory | Description |
|---|---|---|---|---|
text | string | - | Yes | Re-confirmation text. |
textSize | number | 15px | No | Size of the re-confirmation text. |
textColor | color | #000000 | No | Color of the re-confirmation text. |
Common styles are supported.
The width and height related styles are invalid. Set the height based on the element content.
In addition to common events, the events listed in the following table are supported.
Event | Parameter | Trigger Condition |
|---|---|---|
open | - | The button group area is opened. |
close | - | The button group area is closed. |
slide | {offset: offsetValue} | The button group area slides. offset: current sliding distance. |
buttonClick | {id: idValue isSecondaryConfirm: isSecondaryConfirmValue} | A button group is tapped.
|
Method | Parameter | Description |
|---|---|---|
open | - | Opens the button group area. |
close | - | Closes the button group area. |
open parameters
Parameter | Type | Default Value | Mandatory | Description |
|---|---|---|---|---|
animation | boolean | true | No | Indicates whether to enable the open animation. |
close parameters
Parameter | Type | Default Value | Mandatory | Description |
|---|---|---|---|---|
animation | boolean | true | No | Indicates whether to enable the close animation. |
- <template>
- <!-- Only one root node is allowed in template. -->
- <div class="container">
- <text class="title">Left Slide</text>
- <div class="item-container">
- <slide-view class="slide-view" onButtonClick="buttonClick" buttons="{{slideButtons}}" layer="same" edge="left" enableslide="true">
- <div class="inner-div">
- <text class="text-div">Swipe left to delete it</text>
- </div>
- </slide-view>
- </div>
- <text class="title">enableslide = false</text>
- <slide-view class="slide-view" buttons="{{slideButtons}}" layer="same" isopen="false" edge="right" enableslide="false">
- <div class="inner-div">
- <text class="text-div">Swipe left to delete it</text>
- </div>
- </slide-view>
- <text class="title">isopen = true</text>
- <slide-view class="slide-view" buttons="{{slideButtons}}" layer="same" isopen="true" edge="left" enableslide="true">
- <div class="inner-div">
- <text class="text-div">Swipe left to delete it</text>
- </div>
- </slide-view>
- <text class="title">Right Slide</text>
- <slide-view class="slide-view" buttons="{{slideButtons}}" layer="same" isopen="false" edge="right" enableslide="true">
- <div class="inner-div">
- <text class="text-div">Swipe left to delete it</text>
- </div>
- </slide-view>
- <text class="title">Right Above Slide</text>
- <slide-view class="slide-view" buttons="{{slideButtons}}" layer="above" isopen="false" edge="right" enableslide="true">
- <div class="inner-div">
- <text class="text-div">Swipe left to delete it</text>
- </div>
- </slide-view>
- <text class="title">With Static Buttons</text>
- <slide-view id="slideview" class="slide-view" buttons="{{slideButtons}}" layer="same" isopen="false" edge="left" enableslide="true">
- <div class="inner-div">
- <text class="text-div">Swipe left to delete it</text>
- </div>
- </slide-view>
- <input type="button" value="Open" onclick="clickButton" />
- <input type="button" value="Close" onclick="closeclickButton" />
- </div>
- </template>
- <style>
- .container {
- flex-direction: column;
- justify-content: center;
- align-content: center;
- align-items: center;
- }
- .title {
- font-size: 50px;
- margin-top: 40px;
- }
- .buttons {
- margin: 10px;
- border-radius: 15px;
- padding: 15px;
- }
- .surfaceContainer {
- border-width: 2px;
- background-color: #d2691e;
- width: 100%;
- height: 150px;
- text-align: center;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .buttonHolder {
- width: 750px;
- height: 150px;
- display: flex;
- flex-direction: row;
- align-items: center;
- text-align: center;
- background-color: #00ced1;
- justify-content: center;
- }
- .buttonHolder input {
- height: 100px;
- }
- .slide-view {
- width: 100%;
- height: 150px;
- background-color: #00008b;
- }
- .inner-div {
- height: 100px;
- }
- .text-div {
- color: #f0fff0;
- }
- </style>
- <script>
- import prompt from '@system.prompt'
- module.exports = {
- data: {
- title: 'World',
- slideButtons: [
- {
- id: "0",
- buttonWidth: '120px',
- clickButton: false,
- icon: '../Common/ic_update.png',
- text: 'Update',
- backgroundColor: '#FBD4FF',
- iconWidth: '50px',
- iconHeight: '50px',
- backgroundType: 'fill',
- secondaryConfirm: {
- text: "update ?",
- textSize: "12px",
- textColor: "#008000"
- }
- },
- {
- id: "1",
- buttonWidth: '150px',
- icon: '../Common/ic_delete.png',
- //clickButton : true,
- iconBackgroundColor: "#ff0000",
- backgroundColor: '#ff0000',
- backgroundType: 'icon',
- iconWidth: '70px',
- iconHeight: '65px',
- secondaryConfirm: {
- text: "delete ?",
- textSize: "12px",
- textColor: "#008000"
- }
- },
- {
- id: "2",
- buttonWidth: '180px',
- backgroundColor: '#ff0555',
- backgroundType: 'fill',
- text: 'Setting',
- textSize: '15px',
- textColor: '#f0f0f0'
- }
- ]
- },
- clickButton: function () {
- this.$element('slideview').open(true)
- },
- buttonClick(data) {
- const { id, isSecondaryConfirm } = data
- console.info(`### button:${id} is click, data is ${data} ###`)
- if (isSecondaryConfirm) {
- prompt.showToast({
- message: 'Triggered by the second tap.'
- })
- } else {
- prompt.showToast({
- message: 'Triggered by the first tap.'
- })
- }
- },
- closeclickButton: function () { this.$element('slideview').close(true) }
- }
- </script>
Version | Date | Description |
|---|---|---|
1090 | 2022-05-19 | First official version. |