2018-05-29 19:45:27 +00:00
|
|
|
<template>
|
|
|
|
<mk-ui>
|
2018-11-08 18:44:35 +00:00
|
|
|
<span slot="header"><fa icon="list"/>{{ $t('title') }}</span>
|
2018-11-05 16:40:11 +00:00
|
|
|
<template slot="func"><button @click="fn"><fa icon="plus"/></button></template>
|
2018-05-29 19:45:27 +00:00
|
|
|
|
|
|
|
<main>
|
|
|
|
<ul>
|
|
|
|
<li v-for="list in lists" :key="list.id"><router-link :to="`/i/lists/${list.id}`">{{ list.title }}</router-link></li>
|
|
|
|
</ul>
|
|
|
|
</main>
|
|
|
|
</mk-ui>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-11-08 18:44:35 +00:00
|
|
|
import i18n from '../../../i18n';
|
2018-05-29 19:45:27 +00:00
|
|
|
import Progress from '../../../common/scripts/loading';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-08 18:44:35 +00:00
|
|
|
i18n: i18n('mobile/views/pages/user-lists.vue'),
|
2018-05-29 19:45:27 +00:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fetching: true,
|
|
|
|
lists: []
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-11-08 18:44:35 +00:00
|
|
|
document.title = this.$t('title');
|
2018-05-29 19:45:27 +00:00
|
|
|
|
|
|
|
Progress.start();
|
|
|
|
|
|
|
|
(this as any).api('users/lists/list').then(lists => {
|
|
|
|
this.fetching = false;
|
|
|
|
this.lists = lists;
|
|
|
|
|
|
|
|
Progress.done();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
fn() {
|
|
|
|
(this as any).apis.input({
|
2018-11-08 18:44:35 +00:00
|
|
|
title: this.$t('enter-list-name'),
|
2018-05-29 19:45:27 +00:00
|
|
|
}).then(async title => {
|
|
|
|
const list = await (this as any).api('users/lists/create', {
|
|
|
|
title
|
|
|
|
});
|
|
|
|
|
2018-09-01 14:12:51 +00:00
|
|
|
this.$router.push(`/i/lists/${list.id}`);
|
2018-05-29 19:45:27 +00:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-26 11:19:35 +00:00
|
|
|
|
2018-05-29 19:45:27 +00:00
|
|
|
|
|
|
|
main
|
|
|
|
width 100%
|
|
|
|
max-width 680px
|
|
|
|
margin 0 auto
|
|
|
|
padding 8px
|
|
|
|
|
|
|
|
@media (min-width 500px)
|
|
|
|
padding 16px
|
|
|
|
|
|
|
|
@media (min-width 600px)
|
|
|
|
padding 32px
|
|
|
|
|
|
|
|
</style>
|