Skip to content

Commit

Permalink
feat:支持自定义工具项、物料。
Browse files Browse the repository at this point in the history
  • Loading branch information
OXOYO committed Jun 24, 2020
1 parent 2a925ba commit ba69631
Show file tree
Hide file tree
Showing 8 changed files with 2,205 additions and 41 deletions.
8 changes: 8 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,20 @@
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title>x-flowchart-vue</title>
<!-- 使用CDN的CSS文件 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.css) { %>
<link rel="stylesheet" href="<%= htmlWebpackPlugin.options.cdn.css[i] %>" />
<% } %>
</head>
<body>
<noscript>
<strong>We're sorry but x-flowchart-vue doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
<!-- 使用CDN的JS文件 -->
<% for (var i in htmlWebpackPlugin.options.cdn && htmlWebpackPlugin.options.cdn.js) { %>
<script type="text/javascript" src="<%= htmlWebpackPlugin.options.cdn.js[i] %>"></script>
<% } %>
</body>
</html>
32 changes: 0 additions & 32 deletions src/App.vue

This file was deleted.

9 changes: 8 additions & 1 deletion src/Editor/Index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
ShortcutList,
History
},
props: {
tools: Object,
materials: Array
},
data () {
return {
editorInfo: {},
Expand Down Expand Up @@ -311,9 +315,12 @@
// 绑定unload
_t.bindUnload()
// 更新编辑器数据
const tools = _t.tools || _t.$X.config.tools
const materials = _t.materials || _t.$X.config.materials
_t.$store.commit('editor/init', {
instance: _t.editor,
..._t.$X.config.tools
...tools,
materials
})
},
_canvasMousedown () {
Expand Down
12 changes: 8 additions & 4 deletions src/Editor/containers/PanelLeft.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<template>
<CardBox class="panel-left" placement="left" position="right" :width="250" :title="$t('L10300')" @expand="toggleHandler">
<CardItem
v-for="(item, index) in materials"
v-for="(item, index) in materialList"
:key="index"
:title="$t(item.lang) || item.label"
:enableFold="true"
Expand All @@ -36,6 +36,8 @@
</template>

<script>
import { mapGetters } from 'vuex'
import CardBox from '../components/CardBox'
import CardItem from '../components/CardItem'
import NodeElement from '../components/NodeElement'
Expand All @@ -51,9 +53,11 @@
return {}
},
computed: {
materials () {
const { materials } = this.$X.config
return materials.filter(item => item.enable)
...mapGetters([
'materials'
]),
materialList () {
return this.materials.filter(item => item.enable)
}
},
methods: {
Expand Down
Loading

0 comments on commit ba69631

Please sign in to comment.