大屏支持渲染3D模型
This commit is contained in:
@@ -10,6 +10,7 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
width: {default: 400},
|
width: {default: 400},
|
||||||
height: {default: 300},
|
height: {default: 300},
|
||||||
|
is3D: Boolean
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@@ -20,14 +21,20 @@ export default {
|
|||||||
init(count = 0) {
|
init(count = 0) {
|
||||||
const container = this.$refs[this.ref]
|
const container = this.$refs[this.ref]
|
||||||
if (container) {
|
if (container) {
|
||||||
|
let loadTasks = []
|
||||||
let {width, height} = this.$props
|
let {width, height} = this.$props
|
||||||
const scene = new spritejs.Scene({container, width, height, ...this.$attrs}),
|
if (this.is3D) {
|
||||||
layer = scene.layer()
|
loadTasks.push(this.$injectLib("https://unpkg.com/sprite-extend-3d/dist/sprite-extend-3d.js"))
|
||||||
/**
|
}
|
||||||
* layer 图层
|
Promise.all(loadTasks).then(() => {
|
||||||
* lib spritejs的依赖库
|
const scene = new spritejs.Scene({container, width, height, ...this.$attrs}),
|
||||||
*/
|
layer = scene.layer()
|
||||||
this.$emit("init", {layer, lib: spritejs})
|
/**
|
||||||
|
* layer 图层
|
||||||
|
* lib spritejs的依赖库
|
||||||
|
*/
|
||||||
|
this.$emit("init", {layer, lib: spritejs})
|
||||||
|
})
|
||||||
} else if (count == 20) {
|
} else if (count == 20) {
|
||||||
console.log(this.$refs)
|
console.log(this.$refs)
|
||||||
} else setTimeout(() => this.init(++count), 500)
|
} else setTimeout(() => this.init(++count), 500)
|
||||||
|
|||||||
Reference in New Issue
Block a user