forked from FoundKeyGang/FoundKey
refactor pages/user/clips.vue to composition API
This commit is contained in:
parent
dc9bfff337
commit
0cf6df8980
1 changed files with 13 additions and 28 deletions
|
@ -9,40 +9,25 @@
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts" setup>
|
||||||
import { defineComponent } from 'vue';
|
import { watch } from 'vue';
|
||||||
import MkPagination from '@/components/ui/pagination.vue';
|
import MkPagination from '@/components/ui/pagination.vue';
|
||||||
|
|
||||||
export default defineComponent({
|
const props = defineProps<{
|
||||||
components: {
|
user: Record<string, any>;
|
||||||
MkPagination,
|
}>();
|
||||||
},
|
|
||||||
|
|
||||||
props: {
|
const pagination = {
|
||||||
user: {
|
endpoint: 'users/clips',
|
||||||
type: Object,
|
|
||||||
required: true
|
|
||||||
},
|
|
||||||
},
|
|
||||||
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
pagination: {
|
|
||||||
endpoint: 'users/clips' as const,
|
|
||||||
limit: 20,
|
limit: 20,
|
||||||
params: {
|
params: {
|
||||||
userId: this.user.id,
|
userId: props.user.id,
|
||||||
}
|
|
||||||
},
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
|
};
|
||||||
|
|
||||||
watch: {
|
let list = $ref();
|
||||||
user() {
|
|
||||||
this.$refs.list.reload();
|
watch(props.user, () => list.reload());
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
Loading…
Reference in a new issue