From c6c1af91a98292c8c95eb504694e7ec1f8cf2c59 Mon Sep 17 00:00:00 2001 From: xiaozhiyong Date: Wed, 12 Apr 2023 09:14:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/store/piniaIndex.js | 10 ++++++++++ vue.config.js | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/store/piniaIndex.js b/src/store/piniaIndex.js index b523f69..2fa77d4 100644 --- a/src/store/piniaIndex.js +++ b/src/store/piniaIndex.js @@ -28,6 +28,16 @@ const instance = defineStore('user', { actions: { getPosition() { this.position = { latitude: 36.636753, longitude: 119.11914 } + + if (navigator?.geolocation?.getCurrentPosition) { + console.log('存在原生定位') + navigator.geolocation.getCurrentPosition(position => { + console.log('原生定位', position) + }) + } else { + console.log('原生定位不可用') + } + // return initAMap().then(() => { // console.log(3) diff --git a/vue.config.js b/vue.config.js index dae57e4..73fd7a9 100644 --- a/vue.config.js +++ b/vue.config.js @@ -1,6 +1,6 @@ const { defineConfig } = require('@vue/cli-service') const path = require('path') -const port = 9528 + function resolve(dir) { return path.join(__dirname, dir) } @@ -12,7 +12,7 @@ module.exports = defineConfig({ lintOnSave: false, devServer: { - port: port, + port: 9528, // https: true, proxy: { [process.env.VUE_APP_BASE_API]: {