Commit 8ca9389a by dliangx

tauri version update

parent 2533a109
...@@ -12,12 +12,12 @@ name = "xplot_lib" ...@@ -12,12 +12,12 @@ name = "xplot_lib"
crate-type = ["lib", "cdylib", "staticlib"] crate-type = ["lib", "cdylib", "staticlib"]
[build-dependencies] [build-dependencies]
tauri-build = { version = "2.0.0-rc", features = [] } tauri-build = { version = "2.0.0", features = [] }
[dependencies] [dependencies]
tauri = { version = "2.0.0-rc", features = [] } tauri = { version = "2.0.0", features = [] }
tauri-plugin-shell = "2.0.0-rc" tauri-plugin-shell = "2.0.0"
serde = { version = "1", features = ["derive"] } serde = { version = "1", features = ["derive"] }
serde_json = "1" serde_json = "1"
tauri-plugin-http = "2.0.0-rc" tauri-plugin-http = "2.0.0"
import { useEffect, useRef } from "react"; import "ol/ol.css";
import Footer from "../common/Footer"; import Footer from "../common/Footer";
import Map from 'ol/Map'; import "./Land.css";
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
import 'ol/ol.css';
import './Land.css'
import XYZ from "ol/source/XYZ";
const Land = ()=>{ const Land = () => {
const mapRef = useRef(null); return (
const gaodeSource = new XYZ({ <>
url: 'https://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}', <Footer></Footer>
}); </>
);
const gaodeLayer = new TileLayer({ };
source: gaodeSource,
});
useEffect(() => {
if (mapRef.current) {
const map = new Map({
target: mapRef.current,
layers: [
gaodeLayer
],
view: new View({
center: [0, 0],
zoom: 3,
}),
});
return () => {
map.setTarget();
};
}
}, []);
return(<>
<div ref={mapRef} className=" bottom-14 h-3/5 w-full absolute"></div>
<Footer></Footer>
</>)
}
export default Land; export default Land;
\ No newline at end of file
...@@ -8,7 +8,7 @@ import XYZ from "ol/source/XYZ"; ...@@ -8,7 +8,7 @@ import XYZ from "ol/source/XYZ";
const Layers = () => { const Layers = () => {
const mapRef = useRef(null); const mapRef = useRef(null);
const gaodeSource = new XYZ({ const gaodeSource = new XYZ({
url: "https://webrd02.is.autonavi.com/appmaptile?lang=zh_cn&size=1&scale=1&style=8&x={x}&y={y}&z={z}", url: "https://webst01.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}",
}); });
const gaodeLayer = new TileLayer({ const gaodeLayer = new TileLayer({
...@@ -18,15 +18,26 @@ const Layers = () => { ...@@ -18,15 +18,26 @@ const Layers = () => {
if (mapRef.current) { if (mapRef.current) {
const map = new Map({ const map = new Map({
target: mapRef.current, target: mapRef.current,
layers: [gaodeLayer], layers: [
view: new View({ new TileLayer({
center: [0, 0], source: new XYZ({
zoom: 3, url: 'https://webst02.is.autonavi.com/appmaptile?style=6&x={x}&y={y}&z={z}',
minZoom: 3, // 设置最小缩放等级为 5 }),
maxZoom: 18, // 设置最大缩放等级为 15 }), // 高德卫星图层
}), new TileLayer({
source: new XYZ({
url: 'https://wprd0{1-4}.is.autonavi.com/appmaptile?x={x}&y={y}&z={z}&lang=zh_cn&size=1&scl=1&style=8',
}),
}), // 高德道路图层
],
view: new View({
center: [120, 30],
zoom: 3,
maxZoom:18,
minZoom:3
}),
}); });
return () => { return () => {
map.setTarget(); map.setTarget();
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment