|
@@ -14,8 +14,9 @@
|
|
|
</teleport>
|
|
|
</template>
|
|
|
<script lang="ts">
|
|
|
- import { defineComponent, onMounted, ref, watch } from 'vue';
|
|
|
+ import { computed, defineComponent, onMounted, ref, unref, watch } from 'vue';
|
|
|
import { useI18n } from '/@/hooks/useI18n';
|
|
|
+ import { useRtcStore } from '/@/store/modules/rtc';
|
|
|
import { propTypes } from '/@/utils/propTypes';
|
|
|
const refMiniMap = ref<Nullable<string>>(null);
|
|
|
const ifShow = ref(false);
|
|
@@ -33,6 +34,9 @@
|
|
|
},
|
|
|
emits: ['changeMode', 'toggleMap'],
|
|
|
setup(props, { emit }) {
|
|
|
+ const rtcStore = useRtcStore();
|
|
|
+ const isLeader = computed(() => rtcStore.isLeader);
|
|
|
+
|
|
|
const { t } = useI18n();
|
|
|
onMounted(() => {
|
|
|
watch(
|
|
@@ -54,19 +58,26 @@
|
|
|
});
|
|
|
|
|
|
const toggleMap = () => {
|
|
|
- isCollapse.value = !isCollapse.value;
|
|
|
- emit('toggleMap', isCollapse.value);
|
|
|
- let $minmap = document.querySelector('[xui_min_map]');
|
|
|
- if ($minmap) {
|
|
|
- if (!isCollapse.value) {
|
|
|
- $minmap.classList.remove('collapse');
|
|
|
- } else {
|
|
|
- $minmap.classList.add('collapse');
|
|
|
+ debugger;
|
|
|
+ if (unref(isLeader)) {
|
|
|
+ isCollapse.value = !isCollapse.value;
|
|
|
+ emit('toggleMap', isCollapse.value);
|
|
|
+ let $minmap = document.querySelector('[xui_min_map]');
|
|
|
+ if ($minmap) {
|
|
|
+ if (!isCollapse.value) {
|
|
|
+ $minmap.classList.remove('collapse');
|
|
|
+ } else {
|
|
|
+ $minmap.classList.add('collapse');
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
};
|
|
|
const changeMode = () => {
|
|
|
- emit('changeMode', 'dollhouse');
|
|
|
+ console.log('unref(isLeader)', unref(isLeader));
|
|
|
+ debugger;
|
|
|
+ if (unref(isLeader)) {
|
|
|
+ emit('changeMode', 'dollhouse');
|
|
|
+ }
|
|
|
};
|
|
|
|
|
|
return {
|