我该如何在创建节点后,添加属性模板设置更多属性节点UI。
For others:
After creating a node, how can I add an attribute template to set more attribute node UI?
Welcome to the forums @752337625
If you mean attributes, as in Settings for your node??
The first thing todo, is register them in your HTML file
Example : my_custom_attribute
<script type="text/javascript">
RED.nodes.registerType('my-node-type', {
category: '...',
color: '...',
defaults: {
name: { value: 'My Node' },
my_custom_attribute: { value: 'Some Default Value' },
},
inputs: 1,
outputs: 1,
icon: 'some-icon.svg',
label: function () {
return this.name;
}
});
</script>
Also...
Add the HTML inputs - take note of the id
attribute for the element
(it must match its name, along with the prefix) - node-input-{Attribute-Name}
<input type="text" id="node-input-my_custom_attribute" placeholder="Enter Your Value">
Finally, you can access this value in your module...
and utilise as you see fit
module.exports = function (RED) {
function Init(config) {
RED.nodes.createNode(this, config);
const MyAttribute = config.my_custom_attribute
}
RED.nodes.registerType('my-node-type', Init);
}
If this is not what you're asking - my apologies.
你好嗎? Ni hao ma?