Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
71d8c013
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
6018
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看板
提交
71d8c013
编写于
6月 27, 2024
作者:
Anne_LXM
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
同步uni1 web端api示例(地图选择/查看位置)
上级
de036deb
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
197 addition
and
39 deletion
+197
-39
pages.json
pages.json
+14
-0
pages/API/choose-location/choose-location.uvue
pages/API/choose-location/choose-location.uvue
+72
-0
pages/API/open-location/open-location.uvue
pages/API/open-location/open-location.uvue
+75
-0
pages/tabBar/API.uvue
pages/tabBar/API.uvue
+36
-39
未找到文件。
pages.json
浏览文件 @
71d8c013
...
@@ -400,6 +400,20 @@
...
@@ -400,6 +400,20 @@
"navigationBarTitleText"
:
"editor"
"navigationBarTitleText"
:
"editor"
}
}
},
},
{
"path"
:
"pages/API/open-location/open-location"
,
"style"
:
{
"navigationBarTitleText"
:
"open-location"
}
},
{
"path"
:
"pages/API/choose-location/choose-location"
,
"style"
:
{
"navigationBarTitleText"
:
"choose-location"
}
},
//
#endif
//
#endif
{
{
"path"
:
"pages/component/list-view/issue-2199"
,
"path"
:
"pages/component/list-view/issue-2199"
,
...
...
pages/API/choose-location/choose-location.uvue
0 → 100644
浏览文件 @
71d8c013
<template>
<view>
<page-head :title="title"></page-head>
<view class="uni-padding-wrap">
<view style="background:#FFFFFF; padding:40rpx;">
<view class="uni-hello-text uni-center">当前位置信息</view>
<block v-if="hasLocation === false">
<view class="uni-h2 uni-center uni-common-mt">未选择位置</view>
</block>
<block v-if="hasLocation === true">
<view class="uni-hello-text uni-center" style="margin-top:10px;">
{{locationAddress}}
</view>
<view class="uni-h2 uni-center uni-common-mt">
<text>E: {{location.longitude[0]}}°{{location.longitude[1]}}′</text>
<text>\nN: {{location.latitude[0]}}°{{location.latitude[1]}}′</text>
</view>
</block>
</view>
<view class="uni-btn-v">
<button type="primary" @tap="chooseLocation">选择位置</button>
<button @tap="clear">清空</button>
</view>
</view>
</view>
</template>
<script lang="uts">
function formatLocation(longitude, latitude) {
if (typeof longitude === 'string' && typeof latitude === 'string') {
longitude = parseFloat(longitude)
latitude = parseFloat(latitude)
}
longitude = longitude.toFixed(2)
latitude = latitude.toFixed(2)
return {
longitude: longitude.toString().split('.'),
latitude: latitude.toString().split('.')
}
}
export default {
data() {
return {
title: 'chooseLocation',
hasLocation: false,
location: {},
locationAddress: ''
}
},
methods: {
chooseLocation: function () {
uni.chooseLocation({
success: (res) => {
console.log(res,123)
this.hasLocation = true,
this.location = formatLocation(res.longitude, res.latitude),
this.locationAddress = res.address
}
})
},
clear: function () {
this.hasLocation = false
}
}
}
</script>
<style>
.page-body-info {
padding-bottom: 0;
height: 440rpx;
}
</style>
pages/API/open-location/open-location.uvue
0 → 100644
浏览文件 @
71d8c013
<template>
<view>
<page-head :title="title"></page-head>
<view class="uni-common-mt">
<form @submit="openLocation">
<view class="uni-list">
<view class="uni-list-cell">
<view class="uni-list-cell-left">
<view class="uni-label">经度</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" value="116.39747" name="longitude"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-list-cell-left">
<view class="uni-label">纬度</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" value="39.9085" name="latitude"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-list-cell-left">
<view class="uni-label">位置名称</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" value="天安门" name="name"/>
</view>
</view>
<view class="uni-list-cell">
<view class="uni-list-cell-left">
<view class="uni-label">详细位置</view>
</view>
<view class="uni-list-cell-db">
<input class="uni-input" type="text" :disabled="true" value="北京市东城区东长安街" name="address"/>
</view>
</view>
</view>
<view class="uni-padding-wrap">
<view class="uni-btn-v uni-common-mt">
<button type="primary" formType="submit">查看位置</button>
</view>
</view>
</form>
</view>
</view>
</template>
<script lang="uts">
export default {
data() {
return {
title: 'openLocation'
}
},
methods: {
openLocation: function (e) {
console.log(e)
var value = e.detail.value
uni.openLocation({
longitude: Number(value.longitude),
latitude: Number(value.latitude),
name: value.name,
address: value.address
})
}
}
}
</script>
<style>
.uni-list-cell-left {
padding: 0 30rpx;
}
</style>
pages/tabBar/API.uvue
浏览文件 @
71d8c013
...
@@ -206,13 +206,13 @@
...
@@ -206,13 +206,13 @@
name: 'showToast轻提示框',
name: 'showToast轻提示框',
url: 'toast',
url: 'toast',
api: ["showToast"]
api: ["showToast"]
}
}
// #ifdef APP
// #ifdef APP
,{
,{
name: '主题切换',
name: '主题切换',
url: 'theme-change',
url: 'theme-change',
api: ["setAppTheme","onOsThemeChange","offOsThemeChange","onAppThemeChange","offAppThemeChange"]
api: ["setAppTheme","onOsThemeChange","offOsThemeChange","onAppThemeChange","offAppThemeChange"]
}
}
// #endif
// #endif
] as Page[],
] as Page[],
},
},
...
@@ -292,14 +292,14 @@
...
@@ -292,14 +292,14 @@
{
{
name: "打电话",
name: "打电话",
url: "make-phone-call",
url: "make-phone-call",
},
},
{
{
name: "剪贴板",
name: "剪贴板",
url: "clipboard",
url: "clipboard",
},
},
{
{
name: "监听罗盘数据",
name: "监听罗盘数据",
url: "on-compass-change",
url: "on-compass-change",
},
},
// #endif
// #endif
/*
/*
...
@@ -426,11 +426,6 @@
...
@@ -426,11 +426,6 @@
},
},
// #ifdef WEB
// #ifdef WEB
{
{
name: "地图控制",
url: "map",
},
// #endif
/* {
name: "使用地图查看位置",
name: "使用地图查看位置",
url: "open-location",
url: "open-location",
},
},
...
@@ -438,6 +433,8 @@
...
@@ -438,6 +433,8 @@
name: "使用地图选择位置",
name: "使用地图选择位置",
url: "choose-location",
url: "choose-location",
},
},
// #endif
/*
{
{
name: "地图搜索",
name: "地图搜索",
url: "map-search",
url: "map-search",
...
@@ -503,24 +500,24 @@
...
@@ -503,24 +500,24 @@
url: 'facial-recognition-verify',
url: 'facial-recognition-verify',
}
}
] as Page[],
] as Page[],
},
},
{
{
id: 'ad',
id: 'ad',
name: '广告',
name: '广告',
pages: [
pages: [
{
{
name: '激励视频广告',
name: '激励视频广告',
url: 'rewarded-video-ad',
url: 'rewarded-video-ad',
}
}
/* {
/* {
id: "full-screen-video-ad",
id: "full-screen-video-ad",
url: "full-screen-video-ad",
url: "full-screen-video-ad",
name: "全屏视频广告",
name: "全屏视频广告",
enable: false,
enable: false,
pages: [] as Page[]
pages: [] as Page[]
}, */
}, */
] as Page[],
] as Page[],
},
},
// #endif
// #endif
{
{
id: "payment",
id: "payment",
...
@@ -630,4 +627,4 @@
...
@@ -630,4 +627,4 @@
display: none;
display: none;
background-color: rgba(16, 16, 16, 0.5);
background-color: rgba(16, 16, 16, 0.5);
}
}
</style>
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录