We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All
quickApp ReferencesQuick AppElementsslide-view (1090+)

slide-view (1090+)

Overview

Adds buttons, which can be triggered with a sliding gesture, under or outside a view.

Application Scope

Expand

Item

Description

Applicable devices

Mobile phones, tablets, Vision products, and telematics devices

Applicable regions

Global

Subelements

The supported elements are the same as those of the div element.

Attributes

In addition to general attributes, the attributes listed in the following table are supported.

Expand

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.

  • same: button group and main body are at the same level.
  • above: main body is overlaid on the button group.

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

NOTE
  1. The button height cannot be modified.
  2. Buttons are sorted from left to right based on the adding sequence.
Expand

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.

  • fill: background color fills the entire area.
  • icon: only the icon is displayed on the circular background.
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

Expand

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.

Styles

Common styles are supported.

NOTE

The width and height related styles are invalid. Set the height based on the element content.

Events

In addition to common events, the events listed in the following table are supported.

Expand

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.

  • id: sequence number of the button that is tapped.
  • isSecondaryConfirm: indicates whether the tapped object is a re-confirmation text.

Methods

Expand

Method

Parameter

Description

open

-

Opens the button group area.

close

-

Closes the button group area.

open parameters

Expand

Parameter

Type

Default Value

Mandatory

Description

animation

boolean

true

No

Indicates whether to enable the open animation.

close parameters

Expand

Parameter

Type

Default Value

Mandatory

Description

animation

boolean

true

No

Indicates whether to enable the close animation.

Sample Code

Collapse
Word wrap
Dark theme
Copy code
  1. <template>
  2. <!-- Only one root node is allowed in template. -->
  3. <div class="container">
  4. <text class="title">Left Slide</text>
  5. <div class="item-container">
  6. <slide-view class="slide-view" onButtonClick="buttonClick" buttons="{{slideButtons}}" layer="same" edge="left" enableslide="true">
  7. <div class="inner-div">
  8. <text class="text-div">Swipe left to delete it</text>
  9. </div>
  10. </slide-view>
  11. </div>
  12. <text class="title">enableslide = false</text>
  13. <slide-view class="slide-view" buttons="{{slideButtons}}" layer="same" isopen="false" edge="right" enableslide="false">
  14. <div class="inner-div">
  15. <text class="text-div">Swipe left to delete it</text>
  16. </div>
  17. </slide-view>
  18. <text class="title">isopen = true</text>
  19. <slide-view class="slide-view" buttons="{{slideButtons}}" layer="same" isopen="true" edge="left" enableslide="true">
  20. <div class="inner-div">
  21. <text class="text-div">Swipe left to delete it</text>
  22. </div>
  23. </slide-view>
  24. <text class="title">Right Slide</text>
  25. <slide-view class="slide-view" buttons="{{slideButtons}}" layer="same" isopen="false" edge="right" enableslide="true">
  26. <div class="inner-div">
  27. <text class="text-div">Swipe left to delete it</text>
  28. </div>
  29. </slide-view>
  30. <text class="title">Right Above Slide</text>
  31. <slide-view class="slide-view" buttons="{{slideButtons}}" layer="above" isopen="false" edge="right" enableslide="true">
  32. <div class="inner-div">
  33. <text class="text-div">Swipe left to delete it</text>
  34. </div>
  35. </slide-view>
  36. <text class="title">With Static Buttons</text>
  37. <slide-view id="slideview" class="slide-view" buttons="{{slideButtons}}" layer="same" isopen="false" edge="left" enableslide="true">
  38. <div class="inner-div">
  39. <text class="text-div">Swipe left to delete it</text>
  40. </div>
  41. </slide-view>
  42. <input type="button" value="Open" onclick="clickButton" />
  43. <input type="button" value="Close" onclick="closeclickButton" />
  44. </div>
  45. </template>
  46. <style>
  47. .container {
  48. flex-direction: column;
  49. justify-content: center;
  50. align-content: center;
  51. align-items: center;
  52. }
  53. .title {
  54. font-size: 50px;
  55. margin-top: 40px;
  56. }
  57. .buttons {
  58. margin: 10px;
  59. border-radius: 15px;
  60. padding: 15px;
  61. }
  62. .surfaceContainer {
  63. border-width: 2px;
  64. background-color: #d2691e;
  65. width: 100%;
  66. height: 150px;
  67. text-align: center;
  68. display: flex;
  69. align-items: center;
  70. justify-content: center;
  71. }
  72. .buttonHolder {
  73. width: 750px;
  74. height: 150px;
  75. display: flex;
  76. flex-direction: row;
  77. align-items: center;
  78. text-align: center;
  79. background-color: #00ced1;
  80. justify-content: center;
  81. }
  82. .buttonHolder input {
  83. height: 100px;
  84. }
  85. .slide-view {
  86. width: 100%;
  87. height: 150px;
  88. background-color: #00008b;
  89. }
  90. .inner-div {
  91. height: 100px;
  92. }
  93. .text-div {
  94. color: #f0fff0;
  95. }
  96. </style>
  97. <script>
  98. import prompt from '@system.prompt'
  99. module.exports = {
  100. data: {
  101. title: 'World',
  102. slideButtons: [
  103. {
  104. id: "0",
  105. buttonWidth: '120px',
  106. clickButton: false,
  107. icon: '../Common/ic_update.png',
  108. text: 'Update',
  109. backgroundColor: '#FBD4FF',
  110. iconWidth: '50px',
  111. iconHeight: '50px',
  112. backgroundType: 'fill',
  113. secondaryConfirm: {
  114. text: "update ?",
  115. textSize: "12px",
  116. textColor: "#008000"
  117. }
  118. },
  119. {
  120. id: "1",
  121. buttonWidth: '150px',
  122. icon: '../Common/ic_delete.png',
  123. //clickButton : true,
  124. iconBackgroundColor: "#ff0000",
  125. backgroundColor: '#ff0000',
  126. backgroundType: 'icon',
  127. iconWidth: '70px',
  128. iconHeight: '65px',
  129. secondaryConfirm: {
  130. text: "delete ?",
  131. textSize: "12px",
  132. textColor: "#008000"
  133. }
  134. },
  135. {
  136. id: "2",
  137. buttonWidth: '180px',
  138. backgroundColor: '#ff0555',
  139. backgroundType: 'fill',
  140. text: 'Setting',
  141. textSize: '15px',
  142. textColor: '#f0f0f0'
  143. }
  144. ]
  145. },
  146. clickButton: function () {
  147. this.$element('slideview').open(true)
  148. },
  149. buttonClick(data) {
  150. const { id, isSecondaryConfirm } = data
  151. console.info(`### button:${id} is click, data is ${data} ###`)
  152. if (isSecondaryConfirm) {
  153. prompt.showToast({
  154. message: 'Triggered by the second tap.'
  155. })
  156. } else {
  157. prompt.showToast({
  158. message: 'Triggered by the first tap.'
  159. })
  160. }
  161. },
  162. closeclickButton: function () { this.$element('slideview').close(true) }
  163. }
  164. </script>

Version Change History

Expand

Version

Date

Description

1090

2022-05-19

First official version.