{"record":{"id":"b78b5381b71de5cc","repo":"jeecgboot/JeecgBoot","slug":"id-b78b53","errorCode":null,"errorMessage":"地址错误, 配置ID不存在!","messagePattern":"地址错误, 配置ID不存在!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"jeecgboot-vue3/src/views/super/online/cgform/auto/default/OnlineFormUrlAdd.vue","lineNumber":49,"sourceCode":"  import { useOnlineTableContext } from '../../hooks/auto/useOnlineTableContext';\n  import { useListButton } from '../../hooks/auto/useListButton';\n  import { useEnhance } from '../../hooks/auto/useEnhance';\n  import { useRouter } from 'vue-router';\n  import { useFormUrl } from '../../hooks/auto/useFormUrl';\n  const { ID, onlineTableContext, onlineExtConfigJson, handleFormConfig } = useOnlineTableContext();\n  const { createMessage: $message } = useMessage();\n  const wrapRef = ref(null);\n  const contentHeight = ref(400);\n  const loading = ref(true);\n  const router = useRouter();\n\n  const { token } = useFormUrl();\n  if (!unref(token)) {\n    throw new Error('token不存在~');\n  }\n  if (!ID.value) {\n    $message.warning('地址错误, 配置ID不存在!');\n    throw new Error('地址错误, 配置ID不存在!');\n  }\n  // 处理增强\n  let { initCgEnhanceJs } = useEnhance(onlineTableContext);\n  watch(\n    () => wrapRef.value,\n    (elem: HTMLElement) => {\n      // 获取页面实际高度\n      contentHeight.value = elem.offsetHeight - 60;\n    }\n  );\n  // 处理列表button\n  const { registerModal, handleAdd } = useListButton(onlineTableContext, onlineExtConfigJson);\n  const getContainer = (node) => {\n    return document.querySelector(`.online-add-${ID.value}`);\n  };\n  const success = () => {\n    setTimeout(() => {\n      handleAdd(false);","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/jeecgboot/JeecgBoot/blob/96fb33f5ec68516da0b0147da06b2eb0419e063a/jeecgboot-vue3/src/views/super/online/cgform/auto/default/OnlineFormUrlAdd.vue#L31-L67","documentation":"Second setup guard in the URL-style online Add form (same file as the token guard). After the token check passes, if `ID.value` (online form code) is empty it warns and throws, because the Add form cannot build its columns/buttons without the form code.","triggerScenarios":"Token is present but the route lacks the `code` (form id) param: a deep link with only `?token=...` and no code, a menu misconfiguration, or a redirect that dropped the code param.","commonSituations":"Stale bookmark that has a token but no code; menu config lost the code path variable; manual URL entry with token but missing code.","solutions":["Ensure the Add URL carries both token and code: `?token=<jwt>&code=<formCode>`.","For a custom menu, include the online form code in the route path/query.","In dev, append `&code=<yourFormCode>` to the URL.","Add a router guard that redirects when `code` is missing instead of throwing at setup."],"exampleFix":"// before\nif (!ID.value) {\n  $message.warning('地址错误, 配置ID不存在!');\n  throw new Error('地址错误, 配置ID不存在!');\n}\n\n// after — guard at the route level and redirect with a helpful message\nif (!ID.value) {\n  router.replace({ name: 'ExceptionPage', query: { status: '404', reason: 'missing-code' } });\n  return;\n}","handlingStrategy":"validation","validationCode":"// confirm the online form code is present (token already validated above)\nif (!ID.value) {\n  router.replace({ name: 'ExceptionPage', query: { status: '404', reason: 'missing-code' } });\n  return;\n}","typeGuard":"const hasFormCode = (c: unknown): c is string => typeof c === 'string' && c.trim().length > 0;","tryCatchPattern":null,"preventionTips":["Url-form links must carry both `token` and `code`.","Validate required route params in a router guard before mount.","Keep menu/route config in sync with the required params.","Document the expected URL shape for embedded form consumers."],"tags":["vue3","online-cgform","routing","config","setup-guard","url-form","typescript"],"backgroundTag":null,"analyzedSha":"96fb33f5ec68516da0b0147da06b2eb0419e063a","analyzedAt":"2026-08-14T00:04:16.786Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}