mirror of
https://github.com/ArthurDanjou/ui.git
synced 2026-01-14 12:14:41 +01:00
Revert "docs(ComponentCode/ComponentExample): use relative imports"
This reverts commit d75f47419d.
This commit is contained in:
@@ -43,8 +43,7 @@ const { $prettier } = useNuxtApp()
|
||||
|
||||
const camelName = camelCase(props.slug ?? route.params.slug?.[route.params.slug.length - 1] ?? '')
|
||||
const name = `U${upperFirst(camelName)}`
|
||||
|
||||
const component = defineAsyncComponent(() => import(`../../../../src/runtime/components/${upperFirst(camelName)}.vue`))
|
||||
const component = defineAsyncComponent(() => import(`#ui/components/${upperFirst(camelName)}.vue`))
|
||||
|
||||
const componentProps = reactive({ ...(props.props || {}) })
|
||||
const componentEvents = reactive({
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script setup lang="ts">
|
||||
import { upperFirst, camelCase } from 'scule'
|
||||
import { camelCase } from 'scule'
|
||||
import { get, set } from '#ui/utils'
|
||||
|
||||
const props = withDefaults(defineProps<{
|
||||
@@ -52,16 +52,11 @@ const slots = defineSlots<{
|
||||
}>()
|
||||
|
||||
const { $prettier } = useNuxtApp()
|
||||
const route = useRoute()
|
||||
|
||||
const camelName = camelCase(props.name)
|
||||
|
||||
const data = await fetchComponentExample(camelName)
|
||||
|
||||
const dir = route.params.slug?.[route.params.slug.length - 1]
|
||||
|
||||
const component = defineAsyncComponent(() => import(`./examples/${dir}/${upperFirst(camelName)}.vue`))
|
||||
|
||||
const componentProps = reactive({ ...(props.props || {}) })
|
||||
|
||||
const code = computed(() => {
|
||||
@@ -175,7 +170,7 @@ const optionsValues = ref(props.options?.reduce((acc, option) => {
|
||||
</div>
|
||||
|
||||
<div class="flex justify-center p-4" :class="props.class">
|
||||
<component :is="component" v-bind="{ ...componentProps, ...optionsValues }" />
|
||||
<component :is="camelName" v-bind="{ ...componentProps, ...optionsValues }" />
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user