docs: ✏️ 文档演示demo地址调整

This commit is contained in:
xuqingkai 2023-08-04 15:40:35 +08:00
parent dced1a0504
commit c94f4f80ee

View File

@ -1,37 +1,33 @@
<!-- <!--
* @Author: weisheng * @Author: weisheng
* @Date: 2022-12-16 18:03:21 * @Date: 2022-12-16 18:03:21
* @LastEditTime: 2023-08-04 15:27:28 * @LastEditTime: 2023-08-04 15:40:12
* @LastEditors: weisheng * @LastEditors: weisheng
* @Description: * @Description:
* @FilePath: \wot-design-uni\docs\.vitepress\theme\components\frame.vue * @FilePath: \wot-design-uni\docs\.vitepress\theme\components\frame.vue
* 记得注释 * 记得注释
--> -->
<template> <template>
<iframe id="demo-modal" class="iframe demo-model" scrolling="auto" frameborder="0" :src="href"></iframe> <iframe v-if="href" id="demo-modal" class="iframe demo-model" scrolling="auto" frameborder="0" :src="href"></iframe>
</template> </template>
<script setup> <script setup>
import { useRoute } from 'vitepress'; import { useRoute } from 'vitepress';
import { onBeforeMount, ref } from 'vue' import { computed } from 'vue'
let props = defineProps({
url: String,
})
const route = useRoute()
const href = ref('')
onBeforeMount(() => {
const baseUrl = process.env.NODE_ENV === 'production' ? `${location.origin}/demo/?timestamp=${new Date().getTime()}#/` : 'http://localhost:5173/#/' const baseUrl = process.env.NODE_ENV === 'production' ? `${location.origin}/demo/?timestamp=${new Date().getTime()}#/` : 'http://localhost:5173/#/'
const route = useRoute()
const href = computed(() => {
const path = route.path const path = route.path
const paths = path ? path.split('.')[0].split('/') : [] const paths = path ? path.split('.')[0].split('/') : []
let href = ''
if (paths.length) { if (paths.length) {
href.value = baseUrl + `pages/${paths[paths.length - 1]}/Index` href = baseUrl + `pages/${paths[paths.length - 1]}/Index`
} else { } else {
href.value = baseUrl href = baseUrl
} }
return href
}) })
</script> </script>
<style scoped> <style scoped>
::-webkit-scrollbar { ::-webkit-scrollbar {