Sharkey/src/client/app/mobile/views/pages/user-lists.vue

69 lines
1.2 KiB
Vue
Raw Normal View History

2018-05-29 22:45:27 +03:00
<template>
<mk-ui>
<span slot="header">%fa:list%%i18n:@title%</span>
<template slot="func"><button @click="fn">%fa:plus%</button></template>
<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';
import Progress from '../../../common/scripts/loading';
export default Vue.extend({
data() {
return {
fetching: true,
lists: []
};
},
mounted() {
2018-08-07 07:25:50 +03:00
document.title = '%i18n:@title%';
2018-05-29 22:45:27 +03: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({
title: '%i18n:@enter-list-name%',
}).then(async title => {
const list = await (this as any).api('users/lists/create', {
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>
@import '~const.styl'
main
width 100%
max-width 680px
margin 0 auto
padding 8px
@media (min-width 500px)
padding 16px
@media (min-width 600px)
padding 32px
</style>