MCPcopy Index your code
hub / github.com/iChochy/NCE / updateBookSelects

Method updateBookSelects

js/ReadingSystem.js:201–215  ·  view source on GitHub ↗

* 更新所有课本选择器

()

Source from the content-addressed store, hash-verified

199 * 更新所有课本选择器
200 */
201 updateBookSelects() {
202 if (!this.dom.bookSelects.length || !this.state.books.length) return;
203
204 const options = this.state.books
205 .filter((book) => book?.key && book?.title && book?.bookPath)
206 .map((book) => `<option value="${book.key}">${book.title}</option>`)
207 .join('');
208
209 this.dom.bookSelects.forEach((select) => {
210 setHTML(select, options);
211 if (this.state.bookKey) {
212 select.value = this.state.bookKey;
213 }
214 });
215 }
216
217 /**
218 * 渲染空状态提示

Callers 1

applyBookChangeMethod · 0.95

Calls 1

setHTMLFunction · 0.90

Tested by

no test coverage detected