|
@@ -1,6 +1,9 @@
|
|
|
<template>
|
|
|
<div class="ablockly">
|
|
|
- <el-button type="primary" @click="go" class="btnPosition">下一步</el-button>
|
|
|
+ <div class="btnPosition">
|
|
|
+ <el-button type="primary" @click="go">下一步</el-button>
|
|
|
+ <el-button type="primary" @click="returnA" >上一步</el-button>
|
|
|
+ </div>
|
|
|
<div id="blocklyDiv"></div>
|
|
|
<xml id="toolbox" style="display: none">
|
|
|
<category name="逻辑" colour="%{BKY_LOGIC_HUE}">
|
|
@@ -94,7 +97,7 @@ export default {
|
|
|
// 代码生成器
|
|
|
myUpdateFunction(event) {
|
|
|
var code = Blockly.JavaScript.workspaceToCode(this.workspace);
|
|
|
- // debugger;
|
|
|
+ // debugger;
|
|
|
return code;
|
|
|
},
|
|
|
// 获取blockly工作区中的code和xml结构
|
|
@@ -115,6 +118,9 @@ export default {
|
|
|
},
|
|
|
//下一步
|
|
|
go() {
|
|
|
+ // var xmlText =
|
|
|
+ // '<xml xmlns="https://developers.google.com/blockly/xml"><block type="iot_lcd_screeninit" id="{3nwI]%M1OB@v~%c^GJ*" x="270" y="150"><next><block type="controls_repeat_forever" id="%RwQN-vn~S,Qz:U%Dp2C"><statement name="DO"><block type="controls_if" id="tTNBMMPITBf)yE@hA}Lt"><value name="IF0"><block type="logic_compare" id="kW(af5I*_dMR|37aEHA8"><field name="OP">EQ</field><value name="A"><block type="ai_gesture" id="Msy)DT1[/[pA7vU$u2BD"><field name="ID">ID</field></block></value><value name="B"><block type="logic_number" id="F7nQ+Rn{h=Z-:`nxfOV{"><field name="number">布</field></block></value></block></value><statement name="DO0"><block type="ai_motor" id="9=+m`N)^mOs;,8?7ZZ:K"><field name="motor">M1</field><field name="speed">100</field></block></statement><next><block type="controls_if" id="~ykQvxBR]wnz6FHIGc^s"><value name="IF0"><block type="logic_compare" id="+v0*1:oG$.+wMFe_g_F@"><field name="OP">EQ</field><value name="A"><block type="ai_gesture" id=",|{9@1In%8:74vXPPn{O"><field name="ID">ID</field></block></value><value name="B"><block type="logic_number" id="[J4:1z-D*iz3){K$v[gM"><field name="number">石头</field></block></value></block></value><statement name="DO0"><block type="ai_motor" id="XIVuWHcKb[O5|0*HC_Em"><field name="motor">M1</field><field name="speed">0</field></block></statement><next><block type="controls_if" id="bNZCd.Zj2arimcA^dZvc"><value name="IF0"><block type="logic_compare" id="ul/^s*@P{HkWe6(^9fgn"><field name="OP">EQ</field><value name="A"><block type="ai_gesture" id="Wd)15h0yyFb`)Sy:H}0w"><field name="ID">ID</field></block></value><value name="B"><block type="logic_number" id="1f0Wep9dlC0i-})rTiqN"><field name="number">剪刀</field></block></value></block></value><statement name="DO0"><block type="ai_motor" id="bY;.J)_PvmP5TAD/KDs,"><field name="motor">M1</field><field name="speed">50</field></block></statement></block></next></block></next></block></statement></block></next></block></xml>';
|
|
|
+ // this.setBlockData(xmlText);
|
|
|
//update修改 function state里的参数
|
|
|
var a = this.myUpdateFunction();
|
|
|
this.$store.commit("update", ["function", a]);
|
|
@@ -125,6 +131,9 @@ export default {
|
|
|
this.$router.push("function");
|
|
|
}
|
|
|
},
|
|
|
+ returnA() {
|
|
|
+ this.$router.go(-1)
|
|
|
+ },
|
|
|
},
|
|
|
|
|
|
mounted() {
|