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,
FormSection,
FormLink,
FormSuspense,
FormSplit,
},
data() { const initStats = () => os.api('stats', {
return { }).then((res) => {
stats.value = res;
});
defineExpose({
[symbols.PAGE_INFO]: { [symbols.PAGE_INFO]: {
title: this.$ts.instanceInfo, title: i18n.locale.instanceInfo,
icon: 'fas fa-info-circle', icon: 'fas fa-info-circle',
bg: 'var(--bg)', 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() {
return {
[symbols.PAGE_INFO]: { [symbols.PAGE_INFO]: {
title: this.$ts.notFound, title: i18n.locale.notFound,
icon: 'fas fa-exclamation-triangle' icon: 'fas fa-exclamation-triangle',
}, bg: 'var(--bg)',
}
}, },
}); });
</script> </script>