refactor pages/user/clips.vue to composition API

This commit is contained in:
Johann150 2022-07-30 23:35:35 +02:00
parent dc9bfff337
commit 0cf6df8980
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -9,40 +9,25 @@
</div>
</template>
<script lang="ts">
import { defineComponent } from 'vue';
<script lang="ts" setup>
import { watch } from 'vue';
import MkPagination from '@/components/ui/pagination.vue';
export default defineComponent({
components: {
MkPagination,
},
const props = defineProps<{
user: Record<string, any>;
}>();
props: {
user: {
type: Object,
required: true
},
},
data() {
return {
pagination: {
endpoint: 'users/clips' as const,
const pagination = {
endpoint: 'users/clips',
limit: 20,
params: {
userId: this.user.id,
}
userId: props.user.id,
},
};
},
watch: {
user() {
this.$refs.list.reload();
}
},
});
let list = $ref();
watch(props.user, () => list.reload());
</script>
<style lang="scss" scoped>