通过刷新更新使用xml
不清楚标题有没有表达清楚,前解释下问题状况:通过xml在html中插入某些模块
模块插入实现例如
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none">
<category name="诗词匹配" colour="330"> //大模块
<block type="poet3"></block> //大模块里的小模块
<block type="sentence3"></block>
</category>
</xml>
问题:通过刷新随机选取模块,想要写个随机数,用if else选择执行
<xml xmlns="https://developers.google.com/blockly/xml">
<variables>
<variable id=";+!C;^%d=*c:JF2DERF:">poetChoice</variable>
</variables>
<block type="variables_set" id="wO5FzYvbaGR8`nHR#2@6" x="262" y="88">
<field name="VAR" id=";+!C;^%d=*c:JF2DERF:">poetChoice</field>
<value name="VALUE">
<block type="math_random_int" id="p6D2g">
<value name="FROM">
<shadow type="math_number" id="*GT-$N|GB?xW|38+jr7A">
<field name="NUM">0</field>
</shadow>
<block type="math_number" id="]jk/7pFm]7eP34o$OKAH">
<field name="NUM">0</field>
</block>
</value>
<value name="TO">
<shadow type="math_number" id="87$KT5lpDLNCpHl$*Jyy">
<field name="NUM">2</field>
</shadow>
<block type="math_number" id="vTmUD-j*K+:iVg8aRjyU">
<field name="NUM">2</field>
</block>
</value>
</block>
</value>
<next>
<block type="controls_if" id="XZ$!nIDp9).~,8/UkD;N">
<mutation elseif="1" else="1"></mutation>
<value name="IF0">
<block type="logic_compare" id="G#e:-D">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id="txIB]SQw?PPyzXOr9plN">
<field name="VAR" id=";+!C;^%d=*c:JF2DERF:">poetChoice</field>
</block>
</value>
<value name="B">
<block type="math_number" id="[bc,d*BnY3}N9=%$9Azu">
<field name="NUM">0</field>
</block>
</value>
</block>
</value>
<statement name="DO0">
<xml xmlns="https://developers.google.com/blockly/xml" id="toolbox" style="display: none">
<category name="诗词匹配" colour="330">
<block type="poet1"></block>
<block type="sentence1"></block>
</category>
</xml>
</statement>
<value name="IF1">
<block type="logic_compare" id="MV`cQ-*h6vN_)o~A{0lC">
<field name="OP">EQ</field>
<value name="A">
<block type="variables_get" id="%8j3PBPuR^p5Eg+n{En^">
<field name="VAR" id=";+!C;^%d=*c:JF2DERF:">poetChoice</field>
</block>
</value>
<value name="B">
<block type="math_number" id="41O~Cfm_El3~`9Co%6Y#">
<field name="NUM">1</field>
</block>
</value>
</block>
</value>
<statement name="DO1">
<category name="诗词匹配" colour="330" id="toolbox" style="display: none">
<block type="poet1"></block>
<block type="sentence1"></block>
</category>
</statement>
<statement name="ELSE">
<category name="诗词匹配" colour="330" id="toolbox" style="display: none">
<block type="poet1"></block>
<block type="sentence1"></block>
</category>
</statement>
</block>
</next>
</block>
</xml>
结果每回刷新只加载第一个,不能随机
就大佬看看哪里有问题
页:
[1]