summaryrefslogtreecommitdiff
path: root/packages/client/src/pages/my-clips/index.vue
diff options
context:
space:
mode:
Diffstat (limited to 'packages/client/src/pages/my-clips/index.vue')
-rw-r--r--packages/client/src/pages/my-clips/index.vue103
1 files changed, 48 insertions, 55 deletions
diff --git a/packages/client/src/pages/my-clips/index.vue b/packages/client/src/pages/my-clips/index.vue
index ccfb9095d1..97b563f6f8 100644
--- a/packages/client/src/pages/my-clips/index.vue
+++ b/packages/client/src/pages/my-clips/index.vue
@@ -3,7 +3,7 @@
<div class="qtcaoidl">
<MkButton primary class="add" @click="create"><i class="fas fa-plus"></i> {{ $ts.add }}</MkButton>
- <MkPagination v-slot="{items}" ref="list" :pagination="pagination" class="list">
+ <MkPagination v-slot="{items}" ref="pagingComponent" :pagination="pagination" class="list">
<MkA v-for="item in items" :key="item.id" :to="`/clips/${item.id}`" class="item _panel _gap">
<b>{{ item.name }}</b>
<div v-if="item.description" class="description">{{ item.description }}</div>
@@ -13,71 +13,64 @@
</MkSpacer>
</template>
-<script lang="ts">
-import { defineComponent } from 'vue';
+<script lang="ts" setup>
+import { } from 'vue';
import MkPagination from '@/components/ui/pagination.vue';
import MkButton from '@/components/ui/button.vue';
import * as os from '@/os';
import * as symbols from '@/symbols';
+import i18n from '@/components/global/i18n';
-export default defineComponent({
- components: {
- MkPagination,
- MkButton,
- },
-
- data() {
- return {
- [symbols.PAGE_INFO]: {
- title: this.$ts.clip,
- icon: 'fas fa-paperclip',
- bg: 'var(--bg)',
- action: {
- icon: 'fas fa-plus',
- handler: this.create
- }
- },
- pagination: {
- endpoint: 'clips/list' as const,
- limit: 10,
- },
- draft: null,
- };
- },
+const pagination = {
+ endpoint: 'clips/list' as const,
+ limit: 10,
+};
- methods: {
- async create() {
- const { canceled, result } = await os.form(this.$ts.createNewClip, {
- name: {
- type: 'string',
- label: this.$ts.name
- },
- description: {
- type: 'string',
- required: false,
- multiline: true,
- label: this.$ts.description
- },
- isPublic: {
- type: 'boolean',
- label: this.$ts.public,
- default: false
- }
- });
- if (canceled) return;
+const pagingComponent = $ref<InstanceType<typeof MkPagination>>();
- os.apiWithDialog('clips/create', result);
+async function create() {
+ const { canceled, result } = await os.form(i18n.locale.createNewClip, {
+ name: {
+ type: 'string',
+ label: i18n.locale.name,
},
-
- onClipCreated() {
- this.$refs.list.reload();
- this.draft = null;
+ description: {
+ type: 'string',
+ required: false,
+ multiline: true,
+ label: i18n.locale.description,
},
+ isPublic: {
+ type: 'boolean',
+ label: i18n.locale.public,
+ default: false,
+ },
+ });
+ if (canceled) return;
+
+ os.apiWithDialog('clips/create', result);
+
+ pagingComponent.reload();
+}
+
+function onClipCreated() {
+ pagingComponent.reload();
+}
- onClipDeleted() {
- this.$refs.list.reload();
+function onClipDeleted() {
+ pagingComponent.reload();
+}
+
+defineExpose({
+ [symbols.PAGE_INFO]: {
+ title: i18n.locale.clip,
+ icon: 'fas fa-paperclip',
+ bg: 'var(--bg)',
+ action: {
+ icon: 'fas fa-plus',
+ handler: create
},
- }
+ },
});
</script>