View unanswered posts | View active topics It is currently 2022-10-02 14:24



Reply to topic  [ 2 posts ] 
 我在vue中这样自定义图片为什么图片显示不出来呀,哪位大神解答一下 
Author Message
新手上路

Joined: 2022-03-10 17:29
Posts: 3
Post 我在vue中这样自定义图片为什么图片显示不出来呀,哪位大神解答一下
<script>
import twaver from "./twaver";
let box = new twaver.ElementBox();
let network = new twaver.vector.Network(box);
export default {
mounted() {
this.initNetwork();
this.initDataBox();
},
methods: {
initNetwork() {
document.getElementById("xy").appendChild(network.getView());
network.adjustBounds({
x: 0,
y: 0,
width: 1000,
height: 1000,
});
},
//注册图片方法
registerNormalImage(url, name) {
var image = new Image();
image.src = url;
image.onload = function () {
twaver.Util.registerImage(name, image, image.width, image.height);
image.onload = null;
network.invalidateElementUIs();
};
},
initDataBox() {
//注册图片
this.registerNormalImage("../images/twaver.jpg", "twaver");

//在node上使用
var node = new twaver.Node();
node.setImage("twaver");
node.setName("na");
box.add(node);
},
},
};
</script>


2022-03-10 17:33
Profile
TWaver开发组

Joined: 2022-04-28 17:53
Posts: 13
Post Re: 我在vue中这样自定义图片为什么图片显示不出来呀,哪位大神解答一下
twaver注册图片需要能正常访问的图片路径,可以看下控制台是否有图片路径错误或将图片路径放到浏览器地址栏中试下能否正常访问


2022-04-29 9:12
Profile
Display posts from previous:  Sort by  
Reply to topic   [ 2 posts ] 

Who is online

Users browsing this forum: No registered users and 6 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron