2018-05-29 22:45:27 +03:00
|
|
|
<template>
|
|
|
|
<mk-ui>
|
2018-11-08 20:44:35 +02:00
|
|
|
<span slot="header"><fa icon="list"/>{{ $t('title') }}</span>
|
2018-11-05 18:40:11 +02:00
|
|
|
<template slot="func"><button @click="fn"><fa icon="plus"/></button></template>
|
2018-05-29 22:45:27 +03: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 20:44:35 +02:00
|
|
|
import i18n from '../../../i18n';
|
2018-05-29 22:45:27 +03:00
|
|
|
import Progress from '../../../common/scripts/loading';
|
|
|
|
|
|
|
|
export default Vue.extend({
|
2018-11-08 20:44:35 +02:00
|
|
|
i18n: i18n('mobile/views/pages/user-lists.vue'),
|
2018-05-29 22:45:27 +03:00
|
|
|
data() {
|
|
|
|
return {
|
|
|
|
fetching: true,
|
|
|
|
lists: []
|
|
|
|
};
|
|
|
|
},
|
|
|
|
mounted() {
|
2018-11-08 20:44:35 +02:00
|
|
|
document.title = this.$t('title');
|
2018-05-29 22:45:27 +03:00
|
|
|
|
|
|
|
Progress.start();
|
|
|
|
|
2018-11-09 01:13:34 +02:00
|
|
|
this.$root.api('users/lists/list').then(lists => {
|
2018-05-29 22:45:27 +03:00
|
|
|
this.fetching = false;
|
|
|
|
this.lists = lists;
|
|
|
|
|
|
|
|
Progress.done();
|
|
|
|
});
|
|
|
|
},
|
|
|
|
methods: {
|
|
|
|
fn() {
|
|
|
|
(this as any).apis.input({
|
2018-11-08 20:44:35 +02:00
|
|
|
title: this.$t('enter-list-name'),
|
2018-05-29 22:45:27 +03:00
|
|
|
}).then(async title => {
|
2018-11-09 01:13:34 +02:00
|
|
|
const list = await this.$root.api('users/lists/create', {
|
2018-05-29 22:45:27 +03:00
|
|
|
title
|
|
|
|
});
|
|
|
|
|
2018-09-01 17:12:51 +03:00
|
|
|
this.$router.push(`/i/lists/${list.id}`);
|
2018-05-29 22:45:27 +03:00
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
2018-09-26 14:19:35 +03:00
|
|
|
|
2018-05-29 22:45:27 +03: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>
|