42 Star 912 Fork 252

德育处主任/前端数据可视化

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
DrawPath.vue 730 Bytes
一键复制 编辑 原始数据 按行查看 历史
德育处主任 提交于 2021-10-19 23:34 . fabric 不规则图形
<!-- 绘制路径 -->
<template>
<div>
<canvas width="600" height="600" id="canvas" style="border: 1px solid #ccc;"></canvas>
</div>
</template>
<script setup>
import { onMounted } from 'vue'
import { useStore } from 'vuex'
import { fabric } from 'fabric'
const store = useStore()
function init() {
let canvas = new fabric.Canvas('canvas')
let path = new fabric.Path('M 0 0 L 200 100 L 170 200 z')
path.set({
left: 120,
top: 120,
fill: 'hotpink',
opacity: 0.5,
stroke: 'black',
strokeWidth: 10
})
canvas.add(path)
}
onMounted(() => {
store.commit('setComponentPath', 'src/views/FabricJS/Basic/pages/DrawPath/DrawPath.vue')
init()
})
</script>
<style lang="scss" scoped>
</style>
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/k21vin/front-end-data-visualization.git
git@gitee.com:k21vin/front-end-data-visualization.git
k21vin
front-end-data-visualization
前端数据可视化
master

搜索帮助

A270a887 8829481 3d7a4017 8829481