You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
One, you spelled 'bottom' wrong in your location dropdown options.
Second, the code is probably going to look like this: makeNewDance(cat,my_first_dance,top)
whereas I'm guessing you probably want this: makeNewDance("cat", my_first_dance, "top");
If that's the case, then you want this line: var code = 'makeNewDance("'+dropdown_people+'", '+variable_peoplename+', "'+dropdown_location+'");\n';
There may be more issues, but your bug report doesn't actually say what the problem is, so I'm not sure what we should be looking for.
Please ask for help on our forums, not on the issue tracker. If you've found a bug in Blockly fill out the bug template, but we generally won't debug your code here.
Blockly.Blocks['setpeople'] = {
init: function() {
this.appendDummyInput()
.appendField("新建")
.appendField(new Blockly.FieldDropdown([["猫","cat"], ["",""], ["",""]]), "people");
this.appendDummyInput()
.appendField("命名为")
.appendField(new Blockly.FieldVariable("my_first_dance"), "peopleName")
.appendField(",位置位于")
.appendField(new Blockly.FieldDropdown([["顶部","top"], ["底部","bttom"], ["中间","center"]]), "location");
this.setPreviousStatement(true, null);
this.setNextStatement(true, null);
this.setColour(0);
this.setTooltip("");
this.setHelpUrl("");
}
};
Blockly.JavaScript['setpeople'] = function(block) {
var dropdown_people = block.getFieldValue('people');
var variable_peoplename = Blockly.JavaScript.variableDB_.getName(block.getFieldValue('peopleName'), Blockly.Variables.NAME_TYPE);
var dropdown_location = block.getFieldValue('location');
var code = 'makeNewDance('+dropdown_people+','+variable_peoplename+','+dropdown_location+')\n';
return code;
};
var runcode='';
$('.run').on('click',function(){
runcode= Blockly.JavaScript.workspaceToCode(workspace)
})
Content unavailable of return
The text was updated successfully, but these errors were encountered: