摘要: // 导入 bignumber.js 库 const { BigNumber } = require('bignumber.js'); // 封装加法函数 function add(a, b) { const result = new BigNumber(a).plus(b); return res 阅读全文
posted @ 2024-02-16 11:33 吃饭七分饱 阅读(43) 评论(0) 推荐(0) 编辑
摘要: import { Message } from 'element-ui' let lastMessageText = null let messageTimer = null export default function showMessage(options) { // 如果新的消息与上一条消息 阅读全文
posted @ 2023-12-14 11:36 吃饭七分饱 阅读(19) 评论(0) 推荐(0) 编辑
摘要: import Vue from 'vue' export function isOverflow(element) { if (element.scrollWidth > element.offsetWidth) { return element } return null } function g 阅读全文
posted @ 2023-12-05 14:23 吃饭七分饱 阅读(8) 评论(0) 推荐(0) 编辑
摘要: function isOverflow(element) { return element.scrollWidth > element.offsetWidth; } let element = document.querySelector('.ellipsis-span'); let resizeO 阅读全文
posted @ 2023-12-05 09:49 吃饭七分饱 阅读(113) 评论(0) 推荐(0) 编辑
摘要: 增加key属性 阅读全文
posted @ 2023-11-21 09:24 吃饭七分饱 阅读(36) 评论(0) 推荐(0) 编辑
摘要: const fs = require('fs'); const path = require('path'); const HtmlWebpackPlugin = require('html-webpack-plugin'); class BuildTimePlugin { apply(compil 阅读全文
posted @ 2023-11-12 16:47 吃饭七分饱 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 在 Vue 中,你可以通过检查 Vue 实例的 $options.components 属性来判断一个组件是否已经被注册。这个属性包含了所有已经被注册的组件。 以下是一个示例: methods: { isComponentRegistered(componentName) { return this 阅读全文
posted @ 2023-11-10 17:40 吃饭七分饱 阅读(193) 评论(0) 推荐(0) 编辑
摘要: function broadcast(componentName, eventName, params) { this.$children.forEach((child) => { const name = child.$options.componentName; if (name compone 阅读全文
posted @ 2023-11-08 22:00 吃饭七分饱 阅读(13) 评论(0) 推荐(0) 编辑
摘要: import Vue from 'vue' const preventReClick = Vue.directive('preventReClick', { inserted: function(el, binding) { el.addEventListener('click', () => { 阅读全文
posted @ 2023-11-04 11:15 吃饭七分饱 阅读(101) 评论(0) 推荐(0) 编辑
摘要: function generateGradientColor(color1, color2, percentage) { // 将颜色转换为 RGB 格式 function hexToRgb(hex) { const bigint = parseInt(hex.replace('#', ''), 1 阅读全文
posted @ 2023-10-12 15:26 吃饭七分饱 阅读(161) 评论(0) 推荐(0) 编辑