Commit 389685a4 authored by jiaxu.yan's avatar jiaxu.yan

修改背景

parent e7d5bdbe
...@@ -14,13 +14,22 @@ ...@@ -14,13 +14,22 @@
第二视角 第二视角
</button> </button>
</div> </div>
<div v-if="type == 1">
<CanvasWithExternalBackground <CanvasWithExternalBackground
:width="800" :width="800"
:height="600" :height="600"
:background-image-url="backgroundUrl" :background-image-url="backgroundUrl"
@background-updated="handleBackgroundUpdate" @background-updated="handleBackgroundUpdate"
/> />
</div>
<div v-if="type == 2">
<CanvasWithExternalBackground
:width="800"
:height="600"
:background-image-url="backgroundUrl"
@background-updated="handleBackgroundUpdate"
/>
</div>
<div class="controls"> <div class="controls">
<button @click="changeBackground">更换背景图</button> <button @click="changeBackground">更换背景图</button>
<input <input
...@@ -51,7 +60,10 @@ export default { ...@@ -51,7 +60,10 @@ export default {
}, },
data() { data() {
return { return {
backgroundUrl: pic1 // 默认背景图URL backgroundUrl: pic1, // 默认背景图URL
type: 1,
pic1,
pic2
} }
}, },
mounted() { mounted() {
...@@ -64,6 +76,14 @@ export default { ...@@ -64,6 +76,14 @@ export default {
loadBackgroundImage(url) { loadBackgroundImage(url) {
this.backgroundUrl = url this.backgroundUrl = url
}, },
getType(e) {
this.type = e
if (e === 1) {
this.loadBackgroundImage(pic1)
} else {
this.loadBackgroundImage(pic2)
}
},
handleBgChange(e) { handleBgChange(e) {
const file = e.target.files[0] const file = e.target.files[0]
if (!file) return if (!file) return
...@@ -83,9 +103,8 @@ export default { ...@@ -83,9 +103,8 @@ export default {
</script> </script>
<style> <style>
.left-bar {
.left-bar{ padding: 0 20px;
padding:0 20px;
} }
.default-btn { .default-btn {
width: 145px; width: 145px;
......
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