Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
すべてのコンポーネント関数からアクセスできるコンポーネントの「init」関数で変数を定義するにはどうすればよいですか。
変数スコープを使用します。これはコンポーネント専用であり、コンポーネント内の任意の関数内で使用できます
function init(somevalue) { variables.somevalue = arguments.somevalue } function getSomeValue() { return variables.somevalue; }