Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
452d3204
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6016
Star
91
Fork
164
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
452d3204
编写于
7月 03, 2023
作者:
taohebin@dcloud.io
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
getnetworktype 例子
上级
dc06dd5c
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
86 addition
and
12 deletion
+86
-12
pages.json
pages.json
+9
-0
pages/API/get-network-type/get-network-type.uvue
pages/API/get-network-type/get-network-type.uvue
+70
-0
pages/component/list/list.uvue
pages/component/list/list.uvue
+4
-10
pages/tabBar/API/API.uvue
pages/tabBar/API/API.uvue
+2
-1
pages/tabBar/component/component.uvue
pages/tabBar/component/component.uvue
+1
-1
未找到文件。
pages.json
浏览文件 @
452d3204
...
...
@@ -545,6 +545,15 @@
}
}
,{
"path"
:
"pages/API/get-network-type/get-network-type"
,
"style"
:
{
"navigationBarTitleText"
:
""
,
"enablePullDownRefresh"
:
false
}
}
],
"globalStyle"
:
{
"pageOrientation"
:
"portrait"
,
...
...
pages/API/get-network-type/get-network-type.uvue
0 → 100644
浏览文件 @
452d3204
<template>
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap uni-common-mt">
<view style="background:#FFFFFF; padding:40rpx;">
<view class="uni-hello-text uni-center">网络状态</view>
<view v-if="hasNetworkType === false">
<view class="uni-h2 uni-center uni-common-mt">未获取</view>
<view class="uni-hello-text uni-center uni-common-mt">请点击下面按钮获取网络状态</view>
</view>
<view v-if="hasNetworkType === true">
<view class="uni-h2 uni-center uni-common-mt">{{networkType}}</view>
</view>
</view>
<view class="uni-btn-v uni-common-mt">
<button type="primary" @tap="getNetworkType">获取设备网络状态</button>
<button class="uni-common-mt" @tap="clear">清空</button>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
title: 'getNetworkType',
hasNetworkType: false,
networkType: '',
connectedWifi: '',
pageVisible: false
}
},
onLoad() {
this.pageVisible = true;
},
onUnload: function() {
this.pageVisible = false;
this.networkType = '';
this.hasNetworkType = false;
},
methods: {
getNetworkType: function() {
uni.getNetworkType({
success: (res) => {
console.log(res)
this.hasNetworkType = true;
this.networkType = res.networkType
},
fail: () => {
if (this.pageVisible) {
uni.showModal({
content: '获取失败!',
showCancel: false
})
}
}
})
},
clear: function() {
this.hasNetworkType = false;
this.networkType = '';
this.connectedWifi = '';
},
}
}
</script>
<style>
</style>
\ No newline at end of file
pages/component/list/list.uvue
浏览文件 @
452d3204
...
...
@@ -2,9 +2,9 @@
<view style="height: 100%;width: 100%;">
<page-head :title="title"></page-head>
<view class="container">
<list class="uni-list" :refresher-enabled="true" @refresherrefresh="onRefresherrefresh"
<list class="uni-list
-inner
" :refresher-enabled="true" @refresherrefresh="onRefresherrefresh"
:refresher-triggered="refresherTriggered">
<cell
class="list_cell"
v-for="(item, index) in dataList" :key="item.id">
<cell v-for="(item, index) in dataList" :key="item.id">
<view class="list-item">
<text class="list-item-title" :value="item.name"></text>
</view>
...
...
@@ -45,7 +45,7 @@
</script>
<style>
.uni-list {
.uni-list
-inner
{
background-color: #eee;
position: relative;
width: 100%;
...
...
@@ -61,12 +61,6 @@
border: dashed;
height: 100%;
width: 100%;
}
.list_cell{
display: flex;
justify-content: center;
align-items: center;
}
.list-item {
...
...
@@ -74,8 +68,8 @@
margin-right: 12px;
margin-top: 12px;
padding: 20px;
border-radius: 5px;
background-color: #fff;
border-radius: 5px;
}
.list-item-title {
...
...
pages/tabBar/API/API.uvue
浏览文件 @
452d3204
...
...
@@ -121,7 +121,8 @@
pages: [
{
name: "获取设备网络状态",
url: "get-network-type",
url: "get-network-type",
enable:true
},
{
name: "获取系统信息",
...
...
pages/tabBar/component/component.uvue
浏览文件 @
452d3204
...
...
@@ -71,7 +71,7 @@
// #endif
{
name:'list',
enable:
fals
e
enable:
tru
e
}
] as Page[]
}, {
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录