偶然间发现了这个项目,分享出来。
@TOC
fudax/vue-mindeditor
;MeYoung/Case_Minder_Vue
;Vue 全家桶 + Element UI + webpack
开发因为是vue2开发的,vue2的一般16以下,vue3的一般需要18以上
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
source ~/.bashrc
nvm install 14
node --version
npm --version
package-lock.json
;
https://registry.npmmirror.com
# 使用淘宝镜像安装
npm install -g nrm --registry=https://registry.npmmirror.com
# 或直接安装(若网络通畅)
npm install -g nrm
# 方法1:使用 sudo
sudo npm install -g nrm
# 方法2:配置用户级 npm 目录(推荐)
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc
source ~/.bashrc
npm install -g nrm
nrm ls
nrm use taobao
nrm add private http://your-registry-url
nrm del private
npm i # 安装依赖
npm run lib && npm run serve # 本地运行
npm --registry=https://registry.npm.taobao.org install vue-testcase-minder-editor
import 'vue-testcase-minder-editor/lib/VueTestcaseMinderEditor.css'
import VueTestcaseMinderEditor from 'vue-testcase-minder-editor'
Vue.use(VueTestcaseMinderEditor)
Vue.use(Vuex)
const store = new Vuex.Store({
modules: {
caseEditorStore: VueTestcaseMinderEditor.caseEditorStore
}
})
const store = new Vuex.Store({...})
// 动态注册用例编辑器项目的 store 模块到项目中
store.registerModule('caseEditorStore', {
...VueTestcaseMinderEditor.caseEditorStore
})
<template>
<VueTestcaseMinderEditor
:initJson="initJson" // 初始化数据,加载脑图时自动更新。同时也会监听数据变化,数据一更新就重新加载
ref="minderEditor" // 组件应用名称
:allowEditPriority="true" // 是否允许增删改优先级,实时更新状态
:allowEditLabel="true" // 是否允许增删改标签,实时更新状态
:allowEditResult="true" // 是否允许增删改测试结果,实时更新状态
:allowEditNode="true"> // 是否允许增删改节点内容,实时更新状态
</VueTestcaseMinderEditor>
</template>
...
<scripts>
export default {
...
data() {
return {
// 测试数据,实际可不必引入
initJson: {
'data': {
'id': 2,
'text': 'Design project',
'image': 'https://testerhome.com/uploads/user/avatar/6109.jpg',
'imageSize': { 'width': 200, 'height': 200 }
}
}
}
},
methods: {
// 示例方法,实际可根据需要绑定到其他元素事件中,比如 v-on:click="logCurrentData"
logCurrentData: function(event) {
console.log("编辑器中的最新用例内容:", this.$refs.minderEditor.getJsonData())
}
}
}
<scripts>
examples
下面的2个文件。原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。