Commit e859c2cf2507294bf6678558fa0777b6d636cc88

Authored by ww
1 parent 68c3e50e

fix: 修复生产环境无法使用example实例

Showing 1 changed file with 11 additions and 6 deletions
@@ -6,6 +6,11 @@ import { fetchRouteParamsLocation } from '@/utils' @@ -6,6 +6,11 @@ import { fetchRouteParamsLocation } from '@/utils'
6 import { uploadFile } from '@/api/external/contentSave/content' 6 import { uploadFile } from '@/api/external/contentSave/content'
7 import { base64toFile } from '../utils/Base64ToFile.js' 7 import { base64toFile } from '../utils/Base64ToFile.js'
8 import { useSpin } from '../js/libs/spin/useSpin.js' 8 import { useSpin } from '../js/libs/spin/useSpin.js'
  9 +import arkanoid from '../examples/arkanoid.app.json?url'
  10 +import camera from '../examples/camera.app.json?url'
  11 +import particles from '../examples/particles.app.json?url'
  12 +import pong from '../examples/pong.app.json?url'
  13 +import shaders from '../examples/shaders.app.json?url'
9 14
10 function MenubarFile(editor) { 15 function MenubarFile(editor) {
11 const strings = editor.strings 16 const strings = editor.strings
@@ -63,11 +68,11 @@ function MenubarFile(editor) { @@ -63,11 +68,11 @@ function MenubarFile(editor) {
63 // New Project / ... 68 // New Project / ...
64 69
65 const examples = [ 70 const examples = [
66 - { title: 'menubar/file/new/Arkanoid', file: 'arkanoid.app.json' },  
67 - { title: 'menubar/file/new/Camera', file: 'camera.app.json' },  
68 - { title: 'menubar/file/new/Particles', file: 'particles.app.json' },  
69 - { title: 'menubar/file/new/Pong', file: 'pong.app.json' },  
70 - { title: 'menubar/file/new/Shaders', file: 'shaders.app.json' } 71 + { fullPath: arkanoid, title: 'menubar/file/new/Arkanoid', file: 'arkanoid.app.json' },
  72 + { fullPath: camera, title: 'menubar/file/new/Camera', file: 'camera.app.json' },
  73 + { fullPath: particles, title: 'menubar/file/new/Particles', file: 'particles.app.json' },
  74 + { fullPath: pong, title: 'menubar/file/new/Pong', file: 'pong.app.json' },
  75 + { fullPath: shaders, title: 'menubar/file/new/Shaders', file: 'shaders.app.json' }
71 ] 76 ]
72 77
73 const loader = new THREE.FileLoader() 78 const loader = new THREE.FileLoader()
@@ -81,7 +86,7 @@ function MenubarFile(editor) { @@ -81,7 +86,7 @@ function MenubarFile(editor) {
81 option.setTextContent(strings.getKey(example.title)) 86 option.setTextContent(strings.getKey(example.title))
82 option.onClick(function () { 87 option.onClick(function () {
83 if (confirm(strings.getKey('prompt/file/open'))) { 88 if (confirm(strings.getKey('prompt/file/open'))) {
84 - loader.load('examples/' + example.file, function (text) { 89 + loader.load(example.fullPath, function (text) {
85 editor.clear() 90 editor.clear()
86 editor.fromJSON(JSON.parse(text)) 91 editor.fromJSON(JSON.parse(text))
87 }) 92 })