import { useExpressionContext } from '@/stores/expressionContext' import { customRef } from 'vue' export const useShowRef = (code: string, defaultValue: boolean = true) => { return customRef((track, trigger) => { return { get() { track() //通知vue监听数据变化 const { executeCode } = useExpressionContext() return executeCode(code, defaultValue) }, set() { trigger() // 数据变化后通知vue更新页面 }, } }) }