Files
tyass-webview/src/composables/useRiskNotifier.js
2026-02-27 12:24:34 +08:00

19 lines
514 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { watch } from "vue";
/**
* 风险评分通知 composable
* 用于组件向父组件通知自己的风险评分0-100分分数越高越安全
*/
export function useRiskNotifier(props, riskScore) {
// 监听 riskScore 变化,通知父组件
watch(
riskScore,
(newValue) => {
if (props.apiId && props.notifyRiskStatus) {
props.notifyRiskStatus(props.apiId, props.index, newValue);
}
},
{ immediate: true }
);
}