Raj*_*dda 3 svelte svelte-store sveltekit
SvelteKit / Svelte:无法从上下文模块中的“存储”获取或设置(读取或写入)值。
import {selectedStore} from "src/storelocation";
<script context="module">
export const load = async ({params})=> {
$selectedStore.value // throwing error
}
Run Code Online (Sandbox Code Playgroud)
import {selectedStore} from "src/storelocation";
import { get } from 'svelte/store';
<script context="module">
export const load = async ({params})=> {
// use this
get(selectedStore).value;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
3039 次 |
| 最近记录: |