Vue ActionSheet - Customize Item Appearance

For a minor customization of ActionSheet buttons, you can define specific fields in button data objects. For example, the following code generates three buttons, the first is not customized, the second is disabled, the type of the third button is danger.

App.vue
  • <template>
  • <DxActionSheet
  • :data-source="actionSheetData"
  • </DxActionSheet>
  • </template>
  •  
  • <script>
  • import 'devextreme/dist/css/dx.light.css';
  •  
  • import DxActionSheet from 'devextreme-vue/action-sheet';
  •  
  • export default {
  • components: {
  • DxActionSheet
  • },
  • data() {
  • return {
  • actionSheetData: [
  • { text: "Reply" },
  • { text: "Reply All", disabled: true },
  • { text: "Delete", type: 'danger' }
  • ]
  • };
  • }
  • }
  • </script>

If you need a more flexible solution, define an itemTemplate.

App.vue
  • <template>
  • <DxActionSheet
  • v-model:visible="isActionSheetVisible"
  • :data-source="actionSheetData"
  • item-template="link">
  • <template #link="{ data }">
  • <div class="action-sheet-button">
  • <a href="#">{{data.text}}</a>
  • </div>
  • </template>
  • </DxActionSheet>
  • </template>
  •  
  • <script>
  • import 'devextreme/dist/css/dx.light.css';
  •  
  • import DxActionSheet from 'devextreme-vue/action-sheet';
  •  
  • export default {
  • components: {
  • DxActionSheet
  • },
  • data() {
  • return {
  • isActionSheetVisible: true,
  • actionSheetData: [
  • { text: "Reply" },
  • { text: "Reply All" },
  • { text: "Forward" },
  • { text: "Delete" }
  • ]
  • };
  • }
  • }
  • </script>
  •  
  • <style>
  • .action-sheet-button {
  • margin: 5px;
  • padding: 10px;
  • border: 1px dotted #080;
  • background-color: white;
  • }
  • </style>
See Also