Browse Source

feat: 添加点击事件到按钮组件,替换文章组件中的 u-parse 为 mp-html

EvilDragon 3 months ago
parent
commit
116afc01bd

+ 2 - 0
packages/app/src/components/button-evo.vue

@@ -11,6 +11,7 @@ const props = withDefaults(
   defineProps<{ customClass?: string; skew?: boolean } & ComponentProps>(),
   { color: 'primary' },
 )
+const emits = defineEmits<{ click: [] }>()
 const themeVars = { primary: '--evo-theme-primary' }
 const btnThemeClass = { primary: 'before:bg-[--evo-theme-primary] after:bg-[--evo-theme-primary]' }
 
@@ -27,6 +28,7 @@ const height = computed(() => ({ lg: '2.75rem', md: '2.1875rem' })[props.size] |
     :class="`${btnClass} ${{ md: 'pl-7! pr-3.5!' }[size] || ''}`"
     :style="{ '--color': color, '--evo-btn-height': height }"
     :block="block"
+    @click="emits('click')"
   >
     <div
       class="w-full h-full flex items-center justify-center relative z-1 c-white"

+ 4 - 5
packages/app/src/pages/home/components/article.vue

@@ -1,6 +1,6 @@
 <script setup lang="ts">
 import dayjs from 'dayjs'
-import uParse from '@/components/u-parse/u-parse.vue'
+import mpHtml from 'mp-html/dist/uni-app/components/mp-html/mp-html.vue'
 
 defineProps({
   title: {
@@ -51,9 +51,8 @@ defineProps({
       </div>
     </div>
     <!-- <u-parse :content="content"></u-parse> -->
-    <div class="content" v-html="content"></div>
+    <!-- <div class="content" v-html="content"></div> -->
+    <mpHtml :content="content"></mpHtml>
   </div>
 </template>
-<style lang="scss">
-@import url('@/components/u-parse/u-parse.css');
-</style>
+<style lang="scss"></style>