瀏覽代碼

个人优势dompurify

Xiao_123 6 月之前
父節點
當前提交
f178221375

+ 7 - 0
package-lock.json

@@ -14,6 +14,7 @@
         "@wangeditor/editor-for-vue": "^5.1.10",
         "axios": "^1.6.8",
         "crypto-js": "^4.2.0",
+        "dompurify": "^3.2.0",
         "echarts": "^5.4.3",
         "element-plus": "^2.8.0",
         "html2canvas": "^1.4.1",
@@ -2638,6 +2639,12 @@
         "domelementtype": "1"
       }
     },
+    "node_modules/dompurify": {
+      "version": "3.2.0",
+      "resolved": "https://registry.npmmirror.com/dompurify/-/dompurify-3.2.0.tgz",
+      "integrity": "sha512-AMdOzK44oFWqHEi0wpOqix/fUNY707OmoeFDnbi3Q5I8uOpy21ufUA5cDJPr0bosxrflOVD/H2DMSvuGKJGfmQ==",
+      "license": "(MPL-2.0 OR Apache-2.0)"
+    },
     "node_modules/domutils": {
       "version": "1.7.0",
       "resolved": "https://registry.npmmirror.com/domutils/-/domutils-1.7.0.tgz",

+ 1 - 0
package.json

@@ -15,6 +15,7 @@
     "@wangeditor/editor-for-vue": "^5.1.10",
     "axios": "^1.6.8",
     "crypto-js": "^4.2.0",
+    "dompurify": "^3.2.0",
     "echarts": "^5.4.3",
     "element-plus": "^2.8.0",
     "html2canvas": "^1.4.1",

+ 2 - 0
src/views/recruit/personal/PersonalCenter/resume/online/components/selfEvaluation.vue

@@ -32,6 +32,7 @@ import { ref } from 'vue'
 import { saveResumeAdvantage } from '@/api/recruit/personal/resume'
 import Snackbar from '@/plugins/snackbar'
 import { useUserStore } from '@/store/user'
+import DOMPurify from 'dompurify'
 const emit = defineEmits(['complete'])
 
 const isEdit = ref(false)
@@ -61,6 +62,7 @@ const advantageRules = ref([
 
 // 编辑
 const handleSave = async () => {
+  advantage.value = DOMPurify.sanitize(advantage.value)
   if (!advantage.value) return Snackbar.warning('请先输入个人优势!')
   await saveResumeAdvantage({ content: advantage.value })
   isEdit.value = false