.svelte.js 和 .svelte.ts 文件
除了 .svelte
文件,Svelte 还可以操作 .svelte.js
和 .svelte.ts
文件。
¥Besides .svelte
files, Svelte also operates on .svelte.js
and .svelte.ts
files.
这些行为与任何其他 .js
或 .ts
模块一样,只是你可以使用符文。这对于创建可复用的响应式逻辑或在应用中共享响应式状态非常有用(但请注意,你使用的是 无法导出重新分配的状态)。
¥These behave like any other .js
or .ts
module, except that you can use runes. This is useful for creating reusable reactive logic, or sharing reactive state across your app (though note that you cannot export reassigned state).
Legacy mode
这是在 Svelte 5 之前不存在的概念
¥[!LEGACY] This is a concept that didn’t exist prior to Svelte 5
上一页 下一页