使用Vue-cli3生成Vue项目,并等待项目创建成功。
vue create [项目名]
安装mxgraph。
cnpm install mxgraph --save
安装exports-loader。
cnpm install exports-loader --save
安装script-loader。
cnpm install script-loader --save
在项目根目录新建vue.config.js文件。
将以下内容复制到vue.config.js文件中。
const path = require('path'); function resolve(dir) { return path.join(__dirname, dir); } module.exports = { publicPath: './', outputDir: 'dist', lintOnSave: true, chainWebpack: (config) => { config.module .rule('') .test(/mxClient\.js$/) .use('exports-loader') .loader('exports-loader"htmlcode"><template> <div ref="graph_container"></div> </template> <script> import { mxGraph } from 'mxgraph/javascript/mxClient'; export default { name: 'HelloWorld', props: { msg: String }, mounted() { // Creates the graph inside the given container var graph = new mxGraph(this.$refs.graph_container); // Gets the default parent for inserting new cells. This // is normally the first child of the root (ie. layer 0). var parent = graph.getDefaultParent(); // Adds cells to the model in a single step graph.getModel().beginUpdate(); try { let v1 = graph.insertVertex(parent, null, 'Hello,', 20, 20, 80, 30); let v2 = graph.insertVertex(parent, null, 'World!', 200, 150, 80, 30); graph.insertEdge(parent, null, '', v1, v2); } finally { // Updates the display graph.getModel().endUpdate(); } } }; </script> <!-- Add "scoped" attribute to limit CSS to this component only --> <style scoped> h3 { margin: 40px 0 0; } ul { list-style-type: none; padding: 0; } li { display: inline-block; margin: 0 10px; } a { color: #42b983; } </style>运行项目,查看效果。此Demo的源码可以查看
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“Vue-cli3生成的Vue项目加载Mxgraph方法示例”评论...
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新动态
2024年05月04日
2024年05月04日
- 梁紫丹《城市足臃[母带级重生金CD正版CD低速原抓WAV+CUE
- 中唱唱片群星《好歌珍藏-感恩.赞美1》WAV+CUE
- 中唱唱片群星《好歌珍藏-故乡.家园》2CD【WAV+CUE】
- ChrisBotti-ChrisBottiInBoston(克里斯·波提:波士顿音乐会)(2008-9-18)[WAV+CUE]
- 乡村民谣Paul O′Brien《Walk Back Home》[DFF][1.6G]
- 郑秀文《华纳超极品音色系列》[FLAC][927M]
- 群星《高度传真 DSD》[WAV][503M]
- 群星《飞歌》[WAV+CUE][680M]
- 群星《晶音年度发烧试听》非卖品[WAV+CUE][585M]
- 绝对发烧《男女合唱之那个季节里的歌》[WAV+CUE][619M]
- JacobCollier《DjesseVol.1》(2018)Hi-Res96kHz_24bit
- TIS发烧碟《西电王爵士活佛Blueeolution》[WAV+CUE]
- StockfischRecords老虎鱼卡帕与和谐二重唱《远航-遥距的小岛》SACD-ISO
- 古璇《粤听粤好听》柏菲音乐[WAV]
- 李祥庭-幽居(古琴独奏)[正版CD原抓WAV+CUE]