惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

P
Proofpoint News Feed
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
C
Check Point Blog
腾讯CDC
Stack Overflow Blog
Stack Overflow Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
Recent Announcements
Recent Announcements
L
LangChain Blog
Microsoft Azure Blog
Microsoft Azure Blog
小众软件
小众软件
J
Java Code Geeks
博客园_首页
Jina AI
Jina AI
美团技术团队
H
Help Net Security
MyScale Blog
MyScale Blog
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
人人都是产品经理
人人都是产品经理
Y
Y Combinator Blog
S
SegmentFault 最新的问题

Hyde Blog

Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog Hyde Blog
Hyde Blog
Hyde · 2025-10-05 · via Hyde Blog

配置打赏功能 ​

版权 ​

配置打赏功能 ​

配置 ​

  1. docs\.vuepress\config\themeConfig.ts文件:

ts

import htmlModules from './htmlModules' // 自定义插入的html块
// 此处省略其他代码....
htmlModules, // 插入hmtl模块

image-20250216211844247

image-20250216211905661

  1. docs\.vuepress\config\htmlModules.ts文件:

ts

const htmlModule: VdoingThemeConfig["htmlModules"] = {
  //此处省略公众号模块代码...
  pageB: `<div class="donation">
    <button>打赏</button>
    <div class="main">
        <div class="pic">
            <img src="/img/Donation/weixin.jpg" alt="微信">
            <img src="/img/Donation/zhifubao.jpg" alt="支付宝">
        </div>
    </div>
    </div>`,
};

image-20250216212402797

预览

每篇文章尾部都会出现这个赞赏功能哦。

image-20250216213102469

配置赞赏流线边框按钮 ​

效果图 ​

HTML 部分 ​

html

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <button>边框按钮</button>
  </body>
</html>

CSS 部分 ​

css

<style>
    body {
      background-color: #000;
    }
    button {
      width: 100px;
      height: 50px;
      background-color: #000000;
      border: none;
      color: white;
      border-radius: 10px;
      cursor: pointer;
      /* outline: 4px solid rgb(255, 0, 0); */
      /* 设置相对位置 */
      position: relative;
      z-index: 1;
      overflow: hidden;
    }

    /* 设置伪元素 */
    button::before {
      content: "";
      /* 设置内容为空 */
      position: absolute;
      /* 设置定位为绝对定位 */
      width: 200%;
      height: 200%;
      background: linear-gradient(
        114.2deg,
        rgba(184, 215, 21, 1) -15.3%,
        rgba(148, 187, 233, 1) 14.5%,
        rgba(21, 215, 182, 1) 38.7%,
        rgba(129, 189, 240, 1) 58.8%,
        rgba(219, 108, 205, 1) 77.3%,
        rgba(240, 129, 129, 1) 88.5%
      );
      z-index: -2;
      left: 50%;
      top: 50%;
      transform-origin: left top;
      animation: rotation 4s linear infinite;
    }

    @keyframes rotation {
      to {
        transform: rotate(360deg);
      }
    }

    /* 继续设置一个伪元素 */
    button::after {
      content: "";
      position: absolute;
      inset: 4px;
      /* 设置边距 */
      background: #000000;
      z-index: -1;
      border-radius: inherit;
    }
  </style>

完整代码 ​

提示

路径:docs\.vuepress\styles\index.styl

css

// 文章底部打赏按钮
.donation
  position relative
  text-align: center
  margin-top: 10px
  button
    width 5rem
    height 2.5rem
    border: 0
    border-radius .5rem
    color: #fff
    background-color #ffffff00
    font-weight: bold
    opacity 0.9
    transition: all .5s
    cursor: pointer
    position: relative;
    z-index: 1;
    overflow: hidden;
    &:hover,&:focus
      opacity 1
      transform: scale(1.05)
      ~.main
        .pic
          visibility: visible
          opacity 1
          transform: translateY(-1.5rem)
  .main
    position absolute
    bottom 3rem
    left: 0
    right: 0
    pointer-events: none
    .pic
      position relative
      visibility hidden
      display: inline-block
      padding:10px 12px
      background-color:#fff6
      backdrop-filter: blur(6px);
      box-shadow: 0 0 10px 0 #3336
      border-radius: 1rem
      opacity 0
      transition: all .5s
      pointer-events: all
      z-index 10
      &:hover
        visibility visible
        opacity 1
        transform: translateY(-1.5rem)
      &::before
        content: ''
        position absolute
        bottom -@padding[0]
        left: 50%
        right: 50%
        filter: drop-shadow(0px 4px 4px #3336);
        transform: translateX(-50%)
        border-width: (-@bottom) (-@bottom) 0;
        border-style: solid;
        border-color: rgba(#fff,.8) transparent transparent;
      &::after
        content: ''
        display block
        position absolute
        width 100%
        height 2.5rem
      img
        width 10rem
        max-width 40vw

.donation button::before{
    content: ''
    position: absolute
    width: 200%;
      height: 200%;
      background: linear-gradient(
        114.2deg,
        rgba(184, 215, 21, 1) -15.3%,
        rgba(148, 187, 233, 1) 14.5%,
        rgba(21, 215, 182, 1) 38.7%,
        rgba(129, 189, 240, 1) 58.8%,
        rgba(219, 108, 205, 1) 77.3%,
        rgba(240, 129, 129, 1) 88.5%
      );
      z-index: -2;
      left: 50%;
      top: 50%;
      transform-origin: left top;
      animation: rotation 4s linear infinite;
}
 @keyframes rotation {
      to {
        transform: rotate(360deg);
      }
}
.donation button::after {
      content: "";
      position: absolute;
      inset: 4px;
      /* 设置边距 */
      background:#FFA500;
      z-index: -1;
      border-radius: inherit;
}