丰都投票界面已完成
This commit is contained in:
@@ -4,9 +4,9 @@
|
||||
<slot/>
|
||||
</div>
|
||||
<u-gap v-else height="112"/>
|
||||
<div class="fixed" @click="$emit('click')">
|
||||
<div class="fixed" @click="$emit('click')" :style="{background}">
|
||||
<slot v-if="$slots.default"/>
|
||||
<div class="text" v-text="text"/>
|
||||
<div v-else class="text" :class="{circle}" v-text="text"/>
|
||||
</div>
|
||||
</section>
|
||||
</template>
|
||||
@@ -15,7 +15,9 @@
|
||||
export default {
|
||||
name: "AiBottomBtn",
|
||||
props: {
|
||||
text: {default: ""}
|
||||
text: {default: ""},
|
||||
circle: Boolean,
|
||||
background: {default: "inherit"}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -37,6 +39,14 @@ export default {
|
||||
color: #FFFFFF;
|
||||
background: #1365DD;
|
||||
box-shadow: inset 0px 1px 0px 0px #EEEEEE;
|
||||
|
||||
&.circle {
|
||||
border-radius: 52px;
|
||||
line-height: 80px;
|
||||
flex-shrink: 0;
|
||||
padding: 0 70px;
|
||||
width: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.transport {
|
||||
|
||||
55
src/components/AiHighlight.vue
Normal file
55
src/components/AiHighlight.vue
Normal file
@@ -0,0 +1,55 @@
|
||||
<template>
|
||||
<section class="AiHighlight" :class="{bold,color}" v-html="html"/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: "AiHighlight",
|
||||
props: {
|
||||
value: {default: ""},
|
||||
content: {default: ""},
|
||||
keywords: {default: () => []},
|
||||
color: {default: ""},
|
||||
bold: Boolean
|
||||
},
|
||||
computed: {
|
||||
words: v => [v.keywords].flat(),
|
||||
html() {
|
||||
let {content, words, value} = this
|
||||
const reg = new RegExp(`(${words.join("|")})`, 'g')
|
||||
content = content?.replace(/(@v)/g, this.keywordRender(value))
|
||||
return !!words.join("|") ? content?.replace(reg, this.keywordRender('$1')) : content
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
keywordRender(word) {
|
||||
const {color} = this
|
||||
return `<p class="keyword" style="color:${color}">${word}</p>`
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
::v-deep.AiHighlight {
|
||||
display: flex;
|
||||
align-items: baseline;
|
||||
|
||||
.keyword {
|
||||
display: block;
|
||||
width: auto;
|
||||
color: #26f;
|
||||
}
|
||||
|
||||
&.color {
|
||||
.keyword {
|
||||
}
|
||||
}
|
||||
|
||||
&.bold {
|
||||
.keyword {
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user