Răsfoiți Sursa

全局表单seo

rkljw 1 săptămână în urmă
părinte
comite
284f34e240
1 a modificat fișierele cu 11 adăugiri și 3 ștergeri
  1. 11 3
      pages/index_form.vue

+ 11 - 3
pages/index_form.vue

@@ -443,7 +443,7 @@ import { useSeoMeta } from '#imports';
 
 import { ElForm, ElFormItem, ElInput, ElRadioGroup, ElRadio,
          ElCheckboxGroup, ElCheckbox, ElUpload, ElMessage,
-         ElSelect, ElOption, ElDatePicker, ElButton, genFileId } from 'element-plus'
+         ElSelect, ElOption, ElDatePicker, ElButton, genFileId,ElDialog } from 'element-plus'
 
 const { $webUrl, $CwebUrl } = useNuxtApp();
 
@@ -630,7 +630,9 @@ async function refreshCaptcha() {
     }
 }
 
-// 获取form所有数据
+const description = ref('');
+const keywordsData = ref('');
+
 async function get_from_data_fun() {
     pageLoading.value = true
     try {
@@ -647,7 +649,13 @@ async function get_from_data_fun() {
             }
         });
         const get_from_data = await response.json();
-
+        useSeoMeta({
+            title: computed(() => get_from_data.data.table.name + "_" + get_from_data.data.table.website_name + "_" + get_from_data.data.table.suffix),
+            meta: [
+                { name: 'keywords', content: computed(() =>get_from_data.data.table.keywords+ "_" + get_from_data.data.table.website_name + "_" + get_from_data.data.table.suffix), tagPriority: 10 },
+                { name: 'description', content: computed(() =>get_from_data.data.table.description+ "_" + get_from_data.data.table.website_name + "_" + get_from_data.data.table.suffix), tagPriority: 100 }
+            ]
+        });
         // 检查是否需要显示验证码(仅在初始化时)
         if (get_from_data.data?.table?.is_code === 1 && get_from_data.data?.code?.img) {
             showCaptcha.value = true