Sfoglia il codice sorgente

feat: 支持 text\button\image ID

zhangyuhan 2 mesi fa
parent
commit
4c471c7d9b

+ 39 - 0
client/pages/editor/components/attr-configure/attr-props-components/props-attr/alt.vue

@@ -0,0 +1,39 @@
+<template>
+  <div>
+    <el-form-item label="描述">
+      <el-input
+          placeholder="请输入描述 ALT"
+          v-model.trim="tempAlt">
+      </el-input>
+    </el-form-item>
+  </div>
+</template>
+
+<script>
+	export default {
+		name: "attr-alt",
+		props: {
+			alt: String,
+		},
+		data() {
+			return {
+        tempAlt: '',
+			}
+		},
+		mounted() {
+			this.tempAlt = this.alt;
+		},
+		watch: {
+			alt(val) {
+				this.tempAlt = val;
+			},
+      tempAlt() {
+				this.$emit('update:alt', this.tempAlt);
+			}
+		}
+	}
+</script>
+
+<style scoped>
+
+</style>

+ 4 - 0
client/pages/editor/components/attr-configure/attr-props-components/props-attr/index.js

@@ -10,6 +10,8 @@ import NoticeBar from './NoticeBar'
 import avatar from './avatar'
 import Video from './video'
 import SourceForm from './SourceForm'
+import alt from './alt'
+import trackId from './trackId'
 
 export default {
   [Text.name]: Text,
@@ -24,4 +26,6 @@ export default {
   [avatar.name]: avatar,
   [Video.name]: Video,
   [SourceForm.name]: SourceForm,
+  [trackId.name]: trackId,
+  [alt.name]: alt,
 }

+ 39 - 0
client/pages/editor/components/attr-configure/attr-props-components/props-attr/trackId.vue

@@ -0,0 +1,39 @@
+<template>
+  <div>
+    <el-form-item label="ID">
+      <el-input
+          placeholder="请输入ID"
+          v-model.trim="tempId">
+      </el-input>
+    </el-form-item>
+  </div>
+</template>
+
+<script>
+	export default {
+		name: "attr-trackId",
+		props: {
+      trackId: String,
+		},
+		data() {
+			return {
+        tempId: '',
+			}
+		},
+		mounted() {
+			this.tempId = this.trackId;
+		},
+		watch: {
+      trackId(val) {
+				this.tempId = val;
+			},
+      tempId() {
+				this.$emit('update:trackId', this.tempId);
+			}
+		}
+	}
+</script>
+
+<style scoped>
+
+</style>

+ 5 - 1
client/plugins/button/src/index.vue

@@ -1,7 +1,7 @@
 <!--button.vue-->
 <template>
   <div class="DsButton">
-    <van-button :type="btnType" :size="size" >{{text}}</van-button>
+    <van-button :id="trackId" :type="btnType" :size="size" >{{text}}</van-button>
   </div>
 </template>
 
@@ -21,6 +21,10 @@ import { Button } from 'vant';
 				type: String,
 				default: '提 交'
       },
+      trackId: {
+        type: String,
+        default: ''
+      },
       size:{
         type:String,
         default:'large'

+ 14 - 2
client/plugins/image/src/index.vue

@@ -1,8 +1,8 @@
 <!--test.vue-->
 <template>
   <div class="Ds-image">
-    <img draggable="false" :src="imageSrc" alt="" v-if="imageSrc">
-    <img draggable="false" :src="randomImageSrc" alt="" v-else>
+    <img :id="trackId" draggable="false" :src="imageSrc" :alt="alt" v-if="imageSrc">
+    <img :id="trackId" draggable="false" :src="randomImageSrc" :alt="alt" v-else>
   </div>
 </template>
 
@@ -17,6 +17,18 @@
 			imageSrc: {
         type: String,
         default:'https://www.qmx.top/upload/2023/08/08/20230808112413008h619em6N.jpg'
+      },
+      alt: {
+        type: String,
+        default: ''
+      },
+      trackId: {
+        type: String,
+        default: ''
+      },
+      randomImageSrc: {
+        type: String,
+        default:'https://www.qmx.top/upload/2023/08/08/20230808112413008h619em6N.jpg'
       }
     },
     computed: {

+ 5 - 1
client/plugins/text/src/index.vue

@@ -1,7 +1,7 @@
 <!--文本框组件-->
 <template>
   <div class="Ds-text">
-    <div class="text-wrapper" v-html="parseText()" ref="content"></div>
+    <div :id="trackId" class="text-wrapper" v-html="parseText()" ref="content"></div>
   </div>
 </template>
 
@@ -14,6 +14,10 @@ import { filterSensitiveWord ,myReplace} from '@/libs/sensitive_words'
 				type: String,
         default: '这是一段文字'
       },
+      trackId: {
+        type: String,
+        default: ''
+      },
       // fontFamily:{ //字体设置
       //   type:String,
       //   default:"微软雅黑"