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({
|
||||
pages: [
|
||||
'pages/index/index',
|
||||
'pages/webview/index',
|
||||
'pages/yaotouzi/index/index',
|
||||
'pages/game_detail/index',
|
||||
'pages/yaotouzi/records/index',
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
<template>
|
||||
<view class="index">
|
||||
<swiper class="swiper" :circular="true" :autoplay="true">
|
||||
<swiper-item v-for="(item, index) in list" :key="index">
|
||||
<image :src="item" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="container">
|
||||
<!-- <view>摇骰子</view> -->
|
||||
<view class="index">
|
||||
<swiper class="swiper" :circular="true" :autoplay="true">
|
||||
<swiper-item v-for="(item, index) in list" :key="index">
|
||||
<image :src="item" />
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
<view class="container">
|
||||
<!-- <view>摇骰子</view> -->
|
||||
|
||||
<rich-text :nodes="info.introduction"></rich-text>
|
||||
<view class="btn" @click="startGame()">开始游戏</view>
|
||||
</view>
|
||||
<rich-text :nodes="info.introduction"></rich-text>
|
||||
<view class="btn" @click="startGame()">开始游戏</view>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
@@ -23,13 +23,20 @@ const info = ref<any>({})
|
||||
const list = ref<string[]>([])
|
||||
|
||||
Taro.useLoad(() => {
|
||||
info.value = Taro.getStorageSync('gameItem')
|
||||
list.value.push(info.value.cover)
|
||||
info.value = Taro.getStorageSync('gameItem')
|
||||
list.value.push(info.value.cover)
|
||||
})
|
||||
|
||||
const startGame = () => {
|
||||
// 判断url中是否含有http
|
||||
if (info.value.url.indexOf('http') === -1) {
|
||||
Taro.navigateTo({
|
||||
url: info.value.url,
|
||||
url: info.value.url,
|
||||
})
|
||||
} else {
|
||||
Taro.navigateTo({
|
||||
url: `/pages/webview/index?url=${info.value.url}`,
|
||||
})
|
||||
}
|
||||
}
|
||||
</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