Skip to main content

set-mode

Description​

Fires when the mode type is changed

Usage​

"set-mode": ({
mode: "cards" | "table" | "panels" | "search",
}) => boolean | void;

Parameters​

The callback of the set-mode action takes an object with the following parameters:

  • mode - (required) the mode type which can be one of the following: "cards" | "table" | "panels" | "search" cards is the default value

If the callback function for this event returns false, the mode change operation will be blocked.

Example​

In the example below we block the change of the mode type:

<script setup>
import { Filemanager } from "@svar-ui/vue-filemanager";
import { getData, getDrive } from "./common/data";

function init(api) {
api.intercept("set-mode", ({ mode }) => {
console.log(`New mode: ${mode}`);
return false;
});
}
</script>

<template>
<Filemanager
:init="init"
:data="getData()"
:drive="getDrive()"
:mode="'cards'" />
</template>

Related articles: How to access File Manager API