分包和预下载

This commit is contained in:
shikong 2024-10-19 16:00:22 +08:00
parent 14cd4b5ca7
commit 0c171b8171
Signed by: Shikong
GPG Key ID: BD85FF18B373C341
5 changed files with 23 additions and 10 deletions

View File

@ -27,12 +27,6 @@
"navigationBarTitleText": "分类"
}
},
{
"path": "pages/test-page/test-page",
"style": {
"navigationBarTitleText": "测试页面"
}
},
{
"path": "pages/test-page/test-camera",
"style": {
@ -105,5 +99,24 @@
"color": "",
"backgroundColor": ""
},
"subPackages": [
{
"root": "sub-packages/test-page",
"pages": [
{
"path": "pages/test-page",
"style": {
"navigationBarTitleText": "测试页面"
}
}
]
}
],
"preloadRule": {
"pages/my-info/my-info": {
"network": "all",
"packages": ["sub-packages/test-page"]
}
},
"uniIdRouter": {}
}

View File

@ -6,11 +6,11 @@
<button type="warn" @click="toTestPage">进入测试页面</button>
<button class="button" type="primary" @click="getLocation">获取位置</button>
<navigator url="/pages/test-page/test-crypto">
<navigator url="/sub-packages/test-page/pages/test-crypto">
<button>加解密测试页面</button>
</navigator>
<navigator url="/pages/test-page/test-camera">
<navigator url="/sub-packages/test-page/pages/test-camera">
<button>打开相机测试页面</button>
</navigator>
</view>
@ -19,7 +19,7 @@
<script setup>
function toTestPage(){
uni.navigateTo({
url: '/pages/test-page/test-page',
url: '/sub-packages/test-page/pages/test-page',
animationDuration: 100
})
}

View File

@ -65,7 +65,7 @@
</template>
<script setup>
import {useUserStore} from "../../stores/modules/user";
import {useUserStore} from "../../../stores/modules/user";
import {reactive} from "vue";
const ctx = reactive({
request: {