king2088 / vue-3d-loader

VueJS and threeJS 3d viewer plugin
https://king2088.github.io/vue-3d-loader-docs
MIT License
223 stars 38 forks source link

请问一下作者,如何从服务端获取文件并且展示出来啊,比如stl文件存放在服务器上 #66

Closed FengIsTao closed 1 year ago

FengIsTao commented 1 year ago

请问一下作者,如何从服务端获取文件并且展示出来啊,比如stl文件存放在服务器上

king2088 commented 1 year ago

请问一下作者,如何从服务端获取文件并且展示出来啊,比如stl文件存放在服务器上

如果只是从服务器获取stl文件的话,得到stl的http url地址,然后使用浏览器打开,就可以自动下载到你本地了。 至于stl文件的url,你可以在html代码中查找到,大多数网站是会通过其他方式将真实的stl的url隐藏,因此可能会找不到这个url地址

FengIsTao commented 1 year ago

{ "fileName": "2023-05-25/aLkKCEMsrWbJWRY.ply", "fileDownloadUri": "http://xxx.xxx.xxx.xxx:xxxxx/api/yt/oss/download_file/2023-05-25/aLkKCEMsrWbJWRY.ply", "fileType": "application/octet-stream", "size": 3577145, "fileStaticUri": "http://xxx.xxx.xxx.xxx:xxxxx/xxxxxxx/2023-05-25/aLkKCEMsrWbJWRY.ply" } 1 就比如这是我上传的ply文件到服务器,然后服务器返回的内容如上,我要在页面展示出来,直接赋值地址好像没用。 2 我把fileDownloadUri赋值给dataset,然后好像没展示出来,所以问问您服务器地址应该如何展示。 4 静态路径是没问题的,我看了您写的文档,照着做的,现在想用户可以自定义上传文件并且展示出来。 5 image

<vue3dLoader ref="vue3dLoaderRef" :webGLRendererOptions="webGLRendererOptions" :backgroundColor="backgroundColor" :backgroundAlpha="backgroundAlpha" :height="h" :width="w" :filePath="dataset" :autoPlay="autoPlay" :enableDamping="enableDamping" :outputEncoding="outputEncoding" :clearScene="clearScene" :dampingFactor="dampingFactor" :intersectRecursive="true" @process="onProcess" @load="onLoad" @click="onClick" />

king2088 commented 1 year ago

只要你能够通过浏览器访问 http://xxx.xxx.xxx.xxx:xxxxx/api/yt/oss/download_file/2023-05-25/aLkKCEMsrWbJWRY.ply 并且下载文件,就说明这个地址是没有问题的,完全可以用于filePath,但是如果以上url无法通过浏览器访问并下载文件,则此url有问题无法使用。

FengIsTao commented 1 year ago

这样子啊,我试试,谢谢您

king2088 commented 1 year ago

超过7天无回复及跟进