This repository has been archived by the owner on Feb 17, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Migrate to composition api
- Loading branch information
1 parent
8447726
commit c0f7aad
Showing
6 changed files
with
69 additions
and
144 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,14 @@ | ||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
import { windowsStore } from '@/stores/windows'; | ||
import WindowBottom from '../button/WindowBottom.vue'; | ||
<script lang="ts" setup> | ||
import { computed } from 'vue' | ||
import { windowsStore } from '@/stores/windows' | ||
import WindowBottom from '../button/WindowBottom.vue' | ||
export default defineComponent({ | ||
name: 'WindowsArea', | ||
data() { | ||
return { | ||
windowsManager: windowsStore(), | ||
} | ||
}, | ||
computed: { | ||
windows():any[] { | ||
return this.windowsManager.windows | ||
}, | ||
}, | ||
components: { | ||
WindowBottom, | ||
}, | ||
}) | ||
const windowsManager = windowsStore() | ||
const windows = computed((): Array<any> => windowsManager.windows) | ||
</script> | ||
|
||
<template> | ||
<div> | ||
<template v-for="window in windows" :key="window.id"> | ||
<WindowBottom :window="window" /> | ||
</template> | ||
<div class="navale-applications-zone"> | ||
<WindowBottom v-for="window in windows" :key="window?.id" :window="window" /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,16 @@ | ||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
<script lang="ts" setup> | ||
import { inject } from 'vue'; | ||
export default defineComponent({ | ||
name: 'WindowBottom', | ||
props: { | ||
window: { type: Object, required: true } | ||
}, | ||
methods: { | ||
async toggleWindow(): Promise<void> { | ||
await (this as any).$vsk.toggleWindow(this.window.id) | ||
}, | ||
}, | ||
}) | ||
const $vsk:any = inject('vsk') | ||
defineProps<{ window: any }>() | ||
const toggleWindow = async (): Promise<void> => { | ||
await $vsk.toggleWindow((window as any).id) | ||
} | ||
</script> | ||
|
||
<template> | ||
<a class="navbar-brand" href="#" @click="toggleWindow"> | ||
<img | ||
:src="window.icon" | ||
data-bs-toggle="tooltip" | ||
data-bs-placement="left" | ||
:title="window.name" | ||
class="img-fluid win-img" | ||
:alt="window.name" | ||
/> | ||
<a href="#" @click="toggleWindow"> | ||
<img :src="window.icon" :title="window.name" :alt="window.name" /> | ||
</a> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,45 +1,22 @@ | ||
<script lang="ts"> | ||
import { defineComponent } from 'vue' | ||
<script lang="ts" setup> | ||
import { ref, inject } from 'vue' | ||
export default defineComponent({ | ||
name: 'NetworkStatus', | ||
data() { | ||
return { | ||
name: '', | ||
icon: '' | ||
} | ||
}, | ||
mounted() { | ||
setInterval(() => this.checkNetwork(), 2000) | ||
}, | ||
methods: { | ||
async checkNetwork() { | ||
let data = await (this as any).$vsk.getDefaultNetwork() | ||
data = JSON.parse(data) | ||
this.name = data.name | ||
this.icon = data.icon | ||
} | ||
}, | ||
computed: { | ||
networkName() { | ||
return this.name | ||
}, | ||
networkIcon() { | ||
return this.icon | ||
} | ||
} | ||
}) | ||
const $vsk: any = inject('vsk') | ||
const name = ref('') | ||
const icon = ref('') | ||
const checkNetwork = async (): Promise<void> => { | ||
let data = await $vsk.getDefaultNetwork() | ||
data = JSON.parse(data) | ||
name.value = data.name | ||
icon.value = data.icon | ||
} | ||
setInterval(() => checkNetwork(), 2000) | ||
</script> | ||
|
||
<template> | ||
<div id="network"> | ||
<img | ||
data-bs-toggle="tooltip" | ||
data-bs-placement="left" | ||
:title="networkName" | ||
:src="'file://' + networkIcon" | ||
class="img-fluid dock-system-icon" | ||
:alt="networkName" | ||
/> | ||
<img :title="name" :src="'file://' + icon" :alt="name" /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters