refactor(client): use composition api

This commit is contained in:
syuilo 2022-01-07 16:48:51 +09:00
parent 298e950e81
commit 40075761fa
3 changed files with 23 additions and 47 deletions

View File

@ -2,9 +2,5 @@
<MkLoading/> <MkLoading/>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { defineComponent } from 'vue';
import * as os from '@/os';
export default defineComponent({});
</script> </script>

View File

@ -67,8 +67,8 @@
</MkSpacer> </MkSpacer>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { defineComponent } from 'vue'; import { ref } from 'vue';
import { version, instanceName } from '@/config'; import { version, instanceName } from '@/config';
import FormLink from '@/components/form/link.vue'; import FormLink from '@/components/form/link.vue';
import FormSection from '@/components/form/section.vue'; import FormSection from '@/components/form/section.vue';
@ -79,37 +79,21 @@ import * as os from '@/os';
import number from '@/filters/number'; import number from '@/filters/number';
import * as symbols from '@/symbols'; import * as symbols from '@/symbols';
import { host } from '@/config'; import { host } from '@/config';
import { i18n } from '@/i18n';
export default defineComponent({ const stats = ref(null);
components: {
MkKeyValue, const initStats = () => os.api('stats', {
FormSection, }).then((res) => {
FormLink, stats.value = res;
FormSuspense, });
FormSplit,
defineExpose({
[symbols.PAGE_INFO]: {
title: i18n.locale.instanceInfo,
icon: 'fas fa-info-circle',
bg: 'var(--bg)',
}, },
data() {
return {
[symbols.PAGE_INFO]: {
title: this.$ts.instanceInfo,
icon: 'fas fa-info-circle',
bg: 'var(--bg)',
},
host,
version,
instanceName,
stats: null,
initStats: () => os.api('stats', {
}).then((stats) => {
this.stats = stats;
})
}
},
methods: {
number
}
}); });
</script> </script>

View File

@ -7,19 +7,15 @@
</div> </div>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { defineComponent } from 'vue';
import * as os from '@/os';
import * as symbols from '@/symbols'; import * as symbols from '@/symbols';
import { i18n } from '@/i18n';
export default defineComponent({ defineExpose({
data() { [symbols.PAGE_INFO]: {
return { title: i18n.locale.notFound,
[symbols.PAGE_INFO]: { icon: 'fas fa-exclamation-triangle',
title: this.$ts.notFound, bg: 'var(--bg)',
icon: 'fas fa-exclamation-triangle'
},
}
}, },
}); });
</script> </script>