2022-08-26 09:52:43 +00:00
|
|
|
<template>
|
2022-09-07 13:00:03 +00:00
|
|
|
<view class="index">
|
2022-09-08 08:28:56 +00:00
|
|
|
<view v-for="(item, index) in state.pages" :key="index">
|
|
|
|
|
<template v-if="item.name == 'search'">
|
|
|
|
|
<w-search :content="item.content" :styles="item.styles" />
|
|
|
|
|
</template>
|
|
|
|
|
<template v-if="item.name == 'banner'">
|
|
|
|
|
<w-banner :content="item.content" :styles="item.styles" />
|
|
|
|
|
</template>
|
|
|
|
|
<template v-if="item.name == 'nav'">
|
|
|
|
|
<w-nav :content="item.content" :styles="item.styles" />
|
|
|
|
|
</template>
|
|
|
|
|
</view>
|
2022-09-07 13:00:03 +00:00
|
|
|
<view class="article"> </view>
|
2022-08-26 09:52:43 +00:00
|
|
|
</view>
|
|
|
|
|
</template>
|
|
|
|
|
|
2022-09-07 13:00:03 +00:00
|
|
|
<script setup lang="ts">
|
|
|
|
|
import { getIndex } from '@/api/shop'
|
2022-09-08 08:28:56 +00:00
|
|
|
import { reactive, ref } from 'vue'
|
|
|
|
|
const state = reactive<{
|
|
|
|
|
pages: any[]
|
|
|
|
|
}>({
|
2022-09-07 13:00:03 +00:00
|
|
|
pages: []
|
|
|
|
|
})
|
|
|
|
|
const getData = async () => {
|
|
|
|
|
const data = await getIndex()
|
|
|
|
|
state.pages = JSON.parse(data.pages)
|
|
|
|
|
console.log(state.pages)
|
|
|
|
|
}
|
|
|
|
|
getData()
|
|
|
|
|
</script>
|
2022-08-26 09:52:43 +00:00
|
|
|
|
|
|
|
|
<style></style>
|