使用 svg.js 加载图像

问题描述

我在 vue 中使用 svg.js 上传图像时遇到问题。尝试上传图像时出现此错误

vue.runtime.esm.js?2b0e:619 [Vue 警告]:挂载钩子错误: “类型错误:draw.image 不是函数

我的文件: -src/components/picture.vue

<template>
<div class="row">
<div class="col-sm border-right" style="margin-right: 15px;background-color: #f3f3f3;">
</div>
<div class="col-auto" style="width: 703px;">
    <div class="row">
        <div class="col px-1 pt-1 pb-1">
            <div class="border row" style="width: 653px;height: calc(100vh - 61px);overflow: auto;">

                <div id="drawing">
                </div>
            </div>
        </div>
    </div>
</div>
<div class="col-sm border-left" style="margin-left: 15px; background-color: #f3f3f3;">

</div>
</div>
</template>

<script>
import axios from "axios";
import { SVG } from '@svgdotjs/svg.js'


export default {
    data() {
        return {
        }
    },created() {
        
    },mounted() {
        this.start();
    },methods: {
        start() {
            
            let draw = SVG('#drawing');
            draw.image('http://localhost:4000/public/605880a53be09747b07519c2.png');
            draw.size(600,600).y(-150);
            
        }
    }
}
</script>

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)