问题描述
我在添加 SVG.js 库时遇到了一个大问题。就像我不做一样,我仍然画不出任何东西:(
我的文件: -public/index.html
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
<script src="https://cdn.jsdelivr.net/npm/@svgdotjs/[email protected]/dist/svg.min.js"></script>
</head>
<body style="font-size:11px">
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
</html>
-src/main.js
import Vue from 'vue'
import App from './App.vue'
import router from './router'
import { SVG } from '@svgdotjs/svg.js'
import 'bootstrap/dist/css/bootstrap.min.css'
Vue.use(SVG);
Vue.config.productionTip = false
new Vue({
router,SVG,render: h => h(App)
}).$mount('#app')
-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() {
var draw = SVG().addTo('drawing').size(400,400)
var rect = draw.rect(100,100)
},methods: {
}
}
</script>
我在页面上收到此错误:
编译失败。
./src/components/Picture.vue 模块错误(来自 ./node_modules/eslint-loader/index.js):
D:\inzynierka\projekt\src\components\Picture.vue 41:17 错误 'rect' 被赋值但从未使用过 no-unused-vars
✖ 1 个问题(1 个错误,0 个警告)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)