feat(custom): 新增webview
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
export default defineAppConfig({
|
export default defineAppConfig({
|
||||||
pages: [
|
pages: [
|
||||||
'pages/index/index',
|
'pages/index/index',
|
||||||
|
'pages/webview/index',
|
||||||
'pages/yaotouzi/index/index',
|
'pages/yaotouzi/index/index',
|
||||||
'pages/game_detail/index',
|
'pages/game_detail/index',
|
||||||
'pages/yaotouzi/records/index',
|
'pages/yaotouzi/records/index',
|
||||||
|
|||||||
@@ -28,8 +28,15 @@ Taro.useLoad(() => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
const startGame = () => {
|
const startGame = () => {
|
||||||
|
// 判断url中是否含有http
|
||||||
|
if (info.value.url.indexOf('http') === -1) {
|
||||||
Taro.navigateTo({
|
Taro.navigateTo({
|
||||||
url: info.value.url,
|
url: info.value.url,
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
Taro.navigateTo({
|
||||||
|
url: `/pages/webview/index?url=${info.value.url}`,
|
||||||
|
})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
3
src/pages/webview/index.config.ts
Normal file
3
src/pages/webview/index.config.ts
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
export default definePageConfig({
|
||||||
|
navigationBarTitleText: 'webview',
|
||||||
|
})
|
||||||
18
src/pages/webview/index.vue
Normal file
18
src/pages/webview/index.vue
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<web-view :src="src" />
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script setup lang="ts">
|
||||||
|
import { ref } from 'vue'
|
||||||
|
import Taro from '@tarojs/taro'
|
||||||
|
|
||||||
|
const src = ref('')
|
||||||
|
|
||||||
|
Taro.useLoad((e) => {
|
||||||
|
src.value = `${e.url}?uid=${Taro.getStorageSync('uid')}`
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss"></style>
|
||||||
Reference in New Issue
Block a user