docs(pages): pages使用增加说明

This commit is contained in:
Burt 2024-01-04 14:25:41 +08:00
parent 83e19e8eb2
commit f101449b3c
3 changed files with 17 additions and 4 deletions

View File

@ -1,8 +1,18 @@
<template> <template>
<view> <view>
<view>demo</view> <view>demo</view>
<view>测试是否会自动引入到pages发现会</view> <view>测试是否会自动引入到pages发现会除非增加exclude配置</view>
<view>说明components里面的vue文件也会注册为page这个特性感觉不太好</view> <view>需要在vite.config.ts注意不是pages.config.ts中UniPages()配置exclude</view>
<view>我已经在pages.config.ts里面配置了exclude但是没生效</view> <view>配置如下: </view>
<pre>
export default defineConfig({
plugins: [
UniPages({
exclude: ['**/components/**/**.*'],
}),
uni(),
],
})
</pre>
</view> </view>
</template> </template>

View File

@ -27,6 +27,7 @@
<navigator url="/pages/my/index" open-type="navigate" hover-class="navigator-hover"> <navigator url="/pages/my/index" open-type="navigate" hover-class="navigator-hover">
<button type="primary">跳转到我的页面</button> <button type="primary">跳转到我的页面</button>
</navigator> </navigator>
<demo />
</view> </view>
</template> </template>
@ -36,6 +37,7 @@ import { useCountStore, useUserStore } from '@/store'
import { http } from '@/utils/http' import { http } from '@/utils/http'
import { UserItem } from '@/typings' import { UserItem } from '@/typings'
import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app' import { onShareAppMessage, onShareTimeline } from '@dcloudio/uni-app'
import Demo from './components/demo.vue'
const countStore = useCountStore() const countStore = useCountStore()
const title = ref('Hello') const title = ref('Hello')

3
uni-pages.d.ts vendored
View File

@ -7,7 +7,8 @@ interface NavigateToOptions {
url: "pages/index/index" | url: "pages/index/index" |
"pages/demo/index" | "pages/demo/index" |
"pages/my/index" | "pages/my/index" |
"pages/throughout/index"; "pages/throughout/index" |
"pages/index/components/demo";
} }
interface RedirectToOptions extends NavigateToOptions {} interface RedirectToOptions extends NavigateToOptions {}