|
@@ -67,6 +67,7 @@
|
|
|
<div class="tools">
|
|
|
<n-space class="group-type" :size="25">
|
|
|
<n-button
|
|
|
+ v-if="model"
|
|
|
class="model btn"
|
|
|
:class="{
|
|
|
active: isModel,
|
|
@@ -87,6 +88,7 @@
|
|
|
><img src="@/assets/icon_video.png" />视频</n-button
|
|
|
>
|
|
|
<n-button
|
|
|
+ v-if="gallery.length > 0"
|
|
|
class="gallery btn"
|
|
|
:class="{
|
|
|
active: isGallery,
|
|
@@ -101,7 +103,7 @@
|
|
|
>
|
|
|
</n-space>
|
|
|
<div class="actions">
|
|
|
- <div v-if="isModel">
|
|
|
+ <div v-if="isModel && model">
|
|
|
<img src="@/assets/zoom-in.png" @click="handleFullScreen" />
|
|
|
<img src="@/assets/zoom-out.png" @click="handleExitFullScreen" />
|
|
|
<img src="@/assets/reload.png" @click="reloadIframe" />
|
|
@@ -116,36 +118,18 @@
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
|
-import { ref, computed, unref } from "vue";
|
|
|
+import { ref, computed, unref, watchEffect } from "vue";
|
|
|
import { useFullscreen } from "@vueuse/core";
|
|
|
|
|
|
-const iframeRef = ref();
|
|
|
-const containerRef = ref();
|
|
|
-const type = ref("model");
|
|
|
-const defaultType = ref(["model", "video", "audio", "gallery"]);
|
|
|
-const videoRef = ref();
|
|
|
-const modelUrl = import.meta.env.VITE_MODEL_URL;
|
|
|
-
|
|
|
-// ("https://model3d.4dage.com/model/showModel.html?m=d558c919-a001-4aef-a719-18af4ed2bd82");
|
|
|
-
|
|
|
-const iframeURL = ref(modelUrl + "3477401f-6ab6-49cb-b862-a2cc6830d089");
|
|
|
-
|
|
|
-const isModel = computed(() => type.value === "model");
|
|
|
-const isVideo = computed(() => type.value === "video");
|
|
|
-// const isAudio = computed(() => type.value === "audio");
|
|
|
-const isGallery = computed(() => type.value === "gallery");
|
|
|
-const domain = ref(import.meta.env.VITE_DOMAIN_URL);
|
|
|
-const audioSound = ref("");
|
|
|
-const currentSlideIndex = ref(1);
|
|
|
-const { isFullscreen, enter, exit, toggle } = useFullscreen(containerRef);
|
|
|
-
|
|
|
-const isVideoPlaying = ref(false);
|
|
|
-
|
|
|
defineOptions({
|
|
|
name: "show-case",
|
|
|
});
|
|
|
|
|
|
const props = defineProps({
|
|
|
+ active: {
|
|
|
+ type: String,
|
|
|
+ default: () => "",
|
|
|
+ },
|
|
|
model: {
|
|
|
type: String,
|
|
|
default: () => "",
|
|
@@ -164,6 +148,25 @@ const props = defineProps({
|
|
|
},
|
|
|
});
|
|
|
|
|
|
+const iframeRef = ref();
|
|
|
+const containerRef = ref();
|
|
|
+const type = ref("model");
|
|
|
+const defaultType = ref(["model", "video", "audio", "gallery"]);
|
|
|
+const videoRef = ref();
|
|
|
+const modelUrl = import.meta.env.VITE_MODEL_URL;
|
|
|
+const iframeURL = computed(() => modelUrl + props.model);
|
|
|
+
|
|
|
+const isModel = computed(() => type.value === "model");
|
|
|
+const isVideo = computed(() => type.value === "video");
|
|
|
+// const isAudio = computed(() => type.value === "audio");
|
|
|
+const isGallery = computed(() => type.value === "gallery");
|
|
|
+const domain = ref(import.meta.env.VITE_DOMAIN_URL);
|
|
|
+const audioSound = ref("");
|
|
|
+const currentSlideIndex = ref(1);
|
|
|
+const { isFullscreen, enter, exit } = useFullscreen(containerRef);
|
|
|
+
|
|
|
+const isVideoPlaying = ref(false);
|
|
|
+
|
|
|
const handleSwitchType = (value) => {
|
|
|
if (defaultType.value.includes(value)) {
|
|
|
type.value = value;
|
|
@@ -204,6 +207,17 @@ const handleFullScreen = () => {
|
|
|
const handleExitFullScreen = () => {
|
|
|
exit();
|
|
|
};
|
|
|
+watchEffect(() => {
|
|
|
+ if (props.active) {
|
|
|
+ let tempType = "";
|
|
|
+ if (props.active === "img") {
|
|
|
+ tempType = "gallery";
|
|
|
+ } else {
|
|
|
+ tempType = props.active;
|
|
|
+ }
|
|
|
+ handleSwitchType(tempType);
|
|
|
+ }
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style>
|