0

Svelte中导入和使用jsonLogic的语法是什么?

4

1 回答 1

0

在 Svelte 中使用 jsonLogic 不需要修改 jsonLogic javascript,只需像这样导入和使用:

import jsonLogic from './logic.js';  // where logic.js is saved locally in your Svelte public folder
let objJL = jsonLogic;  // assign the jsonLogic instance to a Svelte component variable (I simply named mine objJL)
objJL.apply({"==" : [1,1] }); // try out jsonLogic (this is a true condition)

这里使用 Svelte REPL 进行操作: https ://svelte.dev/repl/a208faeafa4a4615bb5100015d4b1f91

于 2020-07-14T21:09:57.190 回答