mirror of
https://gitee.com/ice-gl/icegl-three-vue-tres.git
synced 2025-04-05 06:22:43 +08:00
普通调试页面的完善
This commit is contained in:
parent
66914bd393
commit
8354b008d0
@ -4,22 +4,22 @@
|
||||
* @Autor: 地虎降天龙
|
||||
* @Date: 2025-03-05 10:47:55
|
||||
* @LastEditors: 地虎降天龙
|
||||
* @LastEditTime: 2025-03-05 12:02:41
|
||||
* @LastEditTime: 2025-03-06 20:37:04
|
||||
-->
|
||||
<template>
|
||||
<div class="title">dsad</div>
|
||||
<div class="title">基础页面与uniapp交互</div>
|
||||
<div class="btn-list">
|
||||
<button class="btn" type="button" data-action="navigateTo">navigateTo</button>
|
||||
<button class="btn" type="button" data-action="redirectTo">redirectTo</button>
|
||||
<button class="btn" type="button" data-action="navigateBack">navigateBack</button>
|
||||
<button class="btn" type="button" data-action="reLaunch">reLaunch</button>
|
||||
<button class="btn btn-red" type="button" data-action="switchTab">switchTab</button>
|
||||
<button class="btn btn-yellow" type="button" @click="postMessage">postMessage</button>
|
||||
<button class="btn btn-yellow" type="button" data-action="getEnv">getEnv</button>
|
||||
<FButton class="btn" size="large" type="primary" long @click="navigateTo()"> navigateTo </FButton>
|
||||
<FButton class="btn" size="large" type="info" long @click="redirectTo()"> redirectTo </FButton>
|
||||
<FButton class="btn" size="large" type="success" long @click="navigateBack()"> navigateBack </FButton>
|
||||
<FButton class="btn" size="large" type="warning" long @click="reLaunch()"> reLaunch </FButton>
|
||||
<FButton class="btn btn-red" size="large" type="primary" long @click="switchTab()"> switchTab </FButton>
|
||||
<FButton class="btn" size="large" type="info" long @click="postMessage()"> postMessage </FButton>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { FMessage, FButton } from '@fesjs/fes-design'
|
||||
import { onMounted } from 'vue'
|
||||
import { loadJweixin, loadWebView } from '../lib/initScript'
|
||||
|
||||
@ -29,21 +29,61 @@ onMounted(async () => {
|
||||
console.log('onMounted')
|
||||
await loadJweixin()
|
||||
await loadWebView()
|
||||
uni.getEnv((res: any) => {
|
||||
alert(`当前环境:${JSON.stringify(res)}`)
|
||||
})
|
||||
if (!uni.getEnv) {
|
||||
FMessage.error('当前web浏览器访问无效,请使用小程序或者app访问该页面')
|
||||
} else {
|
||||
uni.getEnv((res: any) => {
|
||||
FMessage.success(`当前环境:${JSON.stringify(res)}`)
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
const postMessage = () => {
|
||||
uni.postMessage({
|
||||
data: {
|
||||
action: '发送消息了',
|
||||
action: '普通页面发送了消息',
|
||||
},
|
||||
})
|
||||
}
|
||||
const navigateTo = () => {
|
||||
uni.navigateTo({
|
||||
url: '/pages/debugDemo/jumpPage/jumpPage',
|
||||
})
|
||||
}
|
||||
const redirectTo = () => {
|
||||
uni.redirectTo({
|
||||
url: '/pages/debugDemo/jumpPage/jumpPage',
|
||||
})
|
||||
}
|
||||
|
||||
const navigateBack = () => {
|
||||
uni.navigateBack()
|
||||
}
|
||||
const reLaunch = () => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/debugDemo/debugDemo',
|
||||
})
|
||||
}
|
||||
const switchTab = () => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/about/about',
|
||||
})
|
||||
}
|
||||
|
||||
</script>
|
||||
<style lang="less" scoped>
|
||||
.title {
|
||||
color: white;
|
||||
margin: 60px auto;
|
||||
text-align: center;
|
||||
font-size: 20px;
|
||||
font-weight: bold;
|
||||
}
|
||||
.btn-list {
|
||||
padding: 0 20%;
|
||||
}
|
||||
.btn {
|
||||
margin: 20px auto;
|
||||
display: block;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
x
Reference in New Issue
Block a user