Toggle navigation
Toggle navigation
This project
Loading...
Sign in
Hooke
/
data-table
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Graphs
Network
Create a new issue
Commits
Issue Boards
Authored by
hookehuyr
2023-01-05 10:18:37 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
eabc137fa6764391e9631fa95961acfa756b4cde
eabc137f
1 parent
519e8877
新增富文本显示控件
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
44 additions
and
0 deletions
src/components/NoteField/index.vue
src/hooks/useComponentType.js
src/components/NoteField/index.vue
0 → 100644
View file @
eabc137
<!--
* @Date: 2022-08-29 14:31:20
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2023-01-05 10:07:18
* @FilePath: /data-table/src/components/NoteField/index.vue
* @Description: 富文本组件
-->
<template>
<div class="note-field-page">
<div class="label">{{ item.component_props.label }}<span v-if="item.component_props.required"> *</span></div>
<div class="html" style="padding: 0.5rem 1rem 0 1rem;" v-html="item.component_props.note"></div>
</div>
</template>
<script setup>
const props = defineProps({
item: Object,
});
</script>
<style lang="less">
.note-field-page {
.label {
padding: 1rem 1rem 0 1rem;
font-size: 0.9rem;
font-weight: bold;
span {
color: red;
}
}
.html {
img {
width: 100%;
}
}
}
</style>
src/hooks/useComponentType.js
View file @
eabc137
...
...
@@ -26,6 +26,7 @@ import ContactField from '@/components/ContactField/index.vue'
import
RuleField
from
'@/components/RuleField/index.vue'
import
MultiRuleField
from
'@/components/MultiRuleField/index.vue'
import
ButtonField
from
'@/components/ButtonField/index.vue'
import
NoteField
from
'@/components/NoteField/index.vue'
;
/**
* 生成自定义组件类型
...
...
@@ -52,6 +53,7 @@ import ButtonField from '@/components/ButtonField/index.vue'
* @type marquee 跑马灯控件 MarqueeField
* @type rule 活动规则控件 RuleField
* @type multi_rule 活动规则控件 MultiRuleField
* @type note 富文本控件 NoteField
*/
export
function
createComponentType
(
data
)
{
// 判断类型和使用组件
...
...
@@ -160,5 +162,9 @@ export function createComponentType(data) {
item
.
value
=
[];
item
.
component
=
MultiRuleField
;
}
if
(
item
.
component_props
.
tag
===
'note'
)
{
item
.
name
=
item
.
key
;
item
.
component
=
NoteField
;
}
})
}
...
...
Please
register
or
login
to post a comment