Files
halo/ui/console-src/modules/system/plugins/components/entity-fields/SwitchField.vue
Ryan Wang a93479dc34 chore: organize and fix imports (#6152)
#### What type of PR is this?

/area ui
/kind improvement
/milestone 2.17.x

#### What this PR does / why we need it:

重新组织和固定 UI 部分代码的 imports 导入,防止后续因为 imports 的顺序造成不必要的 diff。

基于:https://github.com/halo-dev/halo/pull/6151

#### Does this PR introduce a user-facing change?

```release-note
None
```
2024-06-26 10:42:50 +00:00

31 lines
767 B
Vue

<script lang="ts" setup>
import type { Plugin } from "@halo-dev/api-client";
import { VEntityField, VSwitch } from "@halo-dev/components";
import { toRefs } from "vue";
import { usePluginLifeCycle } from "../../composables/use-plugin";
const props = withDefaults(
defineProps<{
plugin: Plugin;
}>(),
{}
);
const { plugin } = toRefs(props);
const { changingStatus, changeStatus } = usePluginLifeCycle(plugin);
</script>
<template>
<VEntityField v-permission="['system:plugins:manage']">
<template #description>
<div class="flex items-center">
<VSwitch
:model-value="plugin.spec.enabled"
:loading="changingStatus"
@click="changeStatus"
/>
</div>
</template>
</VEntityField>
</template>