Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Creating your own Node - where to add TypedInput on('change') event handlers

未關閉
#332 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

@GogoVega 已經在處理了。

開始於 2025年2月20日。

  • #379 來自 @GogoVega —— 未關閉

評估

難度
3/5
預估耗時
1-2 天
新手友好度
42/100
Issue 類型
文件
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
javascript
領域
documentation

研究方向

檢查 docs/creating-nodes/properties.md 中的「Custom edit behavior」,以及 docs/api/ui/typedInput/index.md 中「Methods」和「Disable state」附近的內容。比較文件所述的 TypedInput change-event 時機與 issue 中的 oneditprepare 範例。當文件說明 handler 何時可以呼叫 TypedInput 方法,並包含一個可正常運作的範例時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

This issue is to suggest a couple of areas where documentation could be improved. Documentation is otherwise very good.

I haven't been able to find documentation for when in time to add a function to watch for change events as documented here. For example, to show/hide or enable/disable an HTML element based on a value of one of the Node properties.

Adding this within oneditprepare does not work ...

    $('#node-input-instruction').on('change', (event, type, value) => {
      if (value === 'turn_on') {
        $('#node-wrapper-speed').typedInput('enable');
        $('#node-wrapper-timeout').typedInput('enable');
      } else if (value === 'turn_off') {
        $('#node-wrapper-speed').typedInput('disable');
        $('#node-wrapper-timeout').typedInput('disable');
      }
    });

... because you get an error since you can't call the typedInput function this early. Is there an official/recommended callback we should be using for once the UI has been setup (added to the DOM, or whaterver work you do)? In the meantime, I am setting hide/show directly on various elements, rather than using typedInput().

Can the documentation in Node Properties and/or TypedInput Widget be updated to make this easier to understand, to provide examples of method calls? Or maybe I've just missed something in the documentation.

If I am confused, maybe others are as well (or maybe they are better at reading documentation).

主要語言
JavaScript
星號
118
分支
161
平均合併
10 小時 37 分鐘
30 天內合併 PR
3

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

node-red/node-red.github.io 的其他 Issue

查看 node-red/node-red.github.io 的全部 Issue

相似的 Issue

更多 JavaScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。