Skip to content

Commit 6de0d3f

Browse files
committed
调整文档
1 parent f16e923 commit 6de0d3f

19 files changed

+92
-68
lines changed

build/gulp/utilGulpFile.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const build: TaskFunction = series(
4545
// 不参与打包
4646
plugins: [
4747
typescript({
48-
tsconfig: resolve(projRoot,'build/config/tsconfig.json')
48+
tsconfig: resolve(projRoot,'/tsconfig.build.json')
4949
}),
5050
nodeResolve({
5151
extensions: ['.mjs', '.js', '.json', '.ts'],
@@ -59,7 +59,7 @@ const build: TaskFunction = series(
5959
target: 'es2017', // default, or 'es20XX', 'esnext'
6060
jsx: 'transform', // default, or 'preserve'
6161
// Like @rollup/plugin-replace
62-
tsconfig: 'tsconfig.json', // default
62+
tsconfig: resolve(projRoot,'/tsconfig.build.json'), // default
6363
// Add extra loaders
6464
loaders: {
6565
// Add .json files support

build/types-definitions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { projRoot } from './utils/paths'
1111
import { excludeFiles } from './utils/pkg'
1212
import type { SourceFile } from 'ts-morph'
1313

14-
const TSCONFIG_PATH = path.resolve(projRoot,'build', 'config' ,'tsconfig.json')
14+
const TSCONFIG_PATH = path.resolve(projRoot,'tsconfig.build.json')
1515

1616
/**
1717
* fork = require( https://github.com/egoist/vue-dts-gen/blob/main/src/index.ts

build/utils/paths.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ export const buildOutput = resolve(projRoot, 'dist')
1717
/** dist/vue-amap */
1818
export const epOutput = resolve(buildOutput, 'vue-amap')
1919

20-
export const buildTsConfigPath = resolve(projRoot, 'build/config/tsconfig.json')
20+
export const buildTsConfigPath = resolve(projRoot, 'tsconfig.build.json')
2121

docs/.vuepress/components/examples/loca/z-marker.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
import {ref} from "vue";
3131
import {ElAmap} from "@vuemap/vue-amap";
3232
import {ElAmapLoca, ElAmapLocaZMarker} from "@vuemap/vue-amap-loca";
33-
33+
const baseUrl = import.meta.env.VITE_ASSERT_BASE_URL;
3434
const zoom = ref(16);
3535
const center = ref([116.597005,39.914388]);
3636
const pitch = ref(55)
3737
38-
const sourceUrl = ref('/json/zmarker.json');
38+
const sourceUrl = ref(`${baseUrl}/json/zmarker.json`);
3939
const layerStyle = ref({
4040
unit: 'meter',
4141
content: (index, feat) => {

docs/.vuepress/components/examples/three/three-gltf-cache.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<el-amap-three-gltf
2020
v-for="item in positions"
2121
:key="item.id"
22-
url="/gltf/sgyj_point_animation.gltf"
22+
:url="baseUrl + '/gltf/sgyj_point_animation.gltf'"
2323
:position="item.lnglat"
2424
:use-model-cache="true"
2525
:scale="[10,10,10]"
@@ -39,13 +39,17 @@ import {
3939
ElAmapThreeLightAmbient,
4040
} from '@vuemap/vue-amap-extra';
4141
42+
type PositionType = {lnglat: number[], id: string}[]
43+
4244
const zoom = ref(18);
4345
const center = ref([121.59996, 31.197646]);
4446
const rotation = ref({x: 90, y: 0, z: 0});
45-
const positions = ref([]);
47+
const positions = ref<PositionType>([]);
48+
49+
const baseUrl = import.meta.env.VITE_ASSERT_BASE_URL;
4650
4751
onBeforeMount(() => {
48-
const array = [];
52+
const array: PositionType = [];
4953
const position = [121.59996, 31.197646];
5054
for (let i = 0; i < 1000; i++) {
5155
const lnglat = [position[0] + Math.random() * 0.01, position[1] + Math.random() * 0.01];

docs/.vuepress/components/examples/three/three-gltf.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@
3030
/>
3131
<el-amap-three-light-spot :position="{x:0, y:1, z:0}" />
3232
<el-amap-three-gltf
33-
url="/gltf/sgyj_point_animation.gltf"
33+
:url="baseUrl + '/gltf/sgyj_point_animation.gltf'"
3434
:position="position"
3535
:scale="[10,10,10]"
3636
:rotation="rotation"
3737
:visible="visible"
3838
@init="init"
3939
/>
4040
<el-amap-three-gltf
41-
url="/gltf/car2.gltf"
41+
:url="baseUrl + '/gltf/car2.gltf'"
4242
:position="carPosition"
4343
:scale="[10,10,10]"
4444
:rotation="rotation"
@@ -77,6 +77,8 @@ import {RenderPass} from 'three/examples/jsm/postprocessing/RenderPass.js';
7777
import {ShaderPass} from 'three/examples/jsm/postprocessing/ShaderPass.js';
7878
import {DotScreenShader} from 'three/examples/jsm/shaders/DotScreenShader.js';
7979
80+
const baseUrl = import.meta.env.VITE_ASSERT_BASE_URL;
81+
8082
const zoom = ref(18);
8183
const center = ref([121.59996, 31.197646]);
8284
const visible = ref(true);
@@ -87,7 +89,7 @@ const moveAnimation = ref({duration: 1000, smooth: true});
8789
const carAngle = ref(90);
8890
const hdrOptions = ref({
8991
urls: ['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'],
90-
path: '/hdr/'
92+
path: `${baseUrl}/hdr/`
9193
});
9294
let carInterval = -1;
9395

docs/.vuepress/components/examples/three/three-layer-event.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
/>
4040
<el-amap-three-light-spot :position="{x:0, y:1, z:0}" />
4141
<el-amap-three-gltf
42-
url="/gltf/sgyj_point_animation.gltf"
42+
:url="baseUrl + '/gltf/sgyj_point_animation.gltf'"
4343
:position="position"
4444
:scale="[10,10,10]"
4545
:rotation="rotation"
@@ -70,14 +70,16 @@ import {
7070
ElAmapThreeLightSpot
7171
} from '@vuemap/vue-amap-extra';
7272
73+
const baseUrl = import.meta.env.VITE_ASSERT_BASE_URL;
74+
7375
const zoom = ref(18);
7476
const center = ref([121.59996, 31.197646]);
7577
const visible = ref(true);
7678
const position = ref([121.59996, 31.197646]);
7779
const rotation = ref({x: 90, y: 0, z: 0});
7880
const hdrOptions = ref({
7981
urls: ['px.hdr', 'nx.hdr', 'py.hdr', 'ny.hdr', 'pz.hdr', 'nz.hdr'],
80-
path: '/hdr/'
82+
path: `${baseUrl}/hdr/`
8183
});
8284
const meshPosition = [121.59896, 31.197646];
8385

docs/.vuepress/components/examples/three/three-video.vue

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ import {ref} from "vue";
4747
import {ElAmap} from "@vuemap/vue-amap";
4848
import {ElAmapLayerThree, ElAmapThreeLightAmbient, ElAmapThreeVideo} from "@vuemap/vue-amap-extra";
4949
50+
const baseUrl = import.meta.env.VITE_ASSERT_BASE_URL;
51+
5052
const videoDestroy = ref(true);
5153
const center = ref([116.306206, 39.975468]);
5254
const zoom = ref(15);
@@ -66,18 +68,18 @@ const videoOption = ref({
6668
height: 246
6769
});
6870
const alwaysFront = ref(true);
69-
const canvas = ref<HTMLCanvasElement>(null);
70-
let context: CanvasRenderingContext2D = null;
71+
const canvas = ref<HTMLCanvasElement>();
72+
let context: CanvasRenderingContext2D;
7173
7274
const clickMap = (e) => {
7375
console.log('click map: ', e);
7476
}
7577
const initMap = (map) => {
7678
console.log('init map: ', map);
7779
canvas.value = document.createElement('canvas') as any;
78-
canvas.value.width = 512;
79-
canvas.value.height = 512;
80-
context = canvas.value.getContext('2d');
80+
canvas.value!.width = 512;
81+
canvas.value!.height = 512;
82+
context = canvas.value?.getContext('2d') as CanvasRenderingContext2D;
8183
}
8284
const changeVisible = () => {
8385
visible.value = !visible.value;
@@ -90,7 +92,7 @@ const initLayer = (layer) => {
9092
}
9193
const init = () => {
9294
const image = new Image();
93-
image.src = "/images/screen.jpeg";
95+
image.src = `${baseUrl}/images/screen.jpeg`;
9496
image.onload = () => {
9597
context?.drawImage(image, 0, 0)
9698
}

docs/.vuepress/data/config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"amap":"2023-11-18","loca":"2023-08-22","extra":"2023-09-16"}
1+
{"amap":"2023-12-02","loca":"2023-08-22","extra":"2023-09-16"}

docs/.vuepress/plugin/demoPlugin.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,15 @@ export const containerPlugin = ():Plugin => {
4141
name: 'demo-plugin',
4242
multiple: true,
4343
}
44-
44+
const domain = 'https://vue-amap.guyixi.cn/'
4545
// if `render` option is not specified
4646
// use `before` and `after` to generate render function
4747
// use markdown-it-container
48+
pluginObj.define = (app) => {
49+
return {
50+
'import.meta.env.VITE_ASSERT_BASE_URL': app.env.isDev ? '' : domain
51+
}
52+
}
4853
pluginObj.extendsMarkdown = (md, app) => {
4954

5055
md.use(mdContainer, 'demo', {
@@ -66,7 +71,8 @@ export const containerPlugin = ():Plugin => {
6671
)
6772
}
6873
if (!source) throw new Error(`Incorrect source file: ${sourceFile}`)
69-
74+
const baseUrl = app.env.isDev ? '' : domain
75+
source = source.replace('import.meta.env.VITE_ASSERT_BASE_URL', JSON.stringify(baseUrl));
7076
return `<vp-demo source="${encodeURIComponent(
7177
highlight(source, 'vue')
7278
)}" path="${sourceFile}" raw-source="${encodeURIComponent(

0 commit comments

Comments
 (0)