From 61b1fd2fb7efb5ef836eb1c8b5fb8b155be99f79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A6=92=E5=A4=B4=E9=A5=AD?= Date: Thu, 11 May 2023 22:04:21 +0800 Subject: [PATCH] :bug:fix buttery load twice trigger undefined bug --- README.md | 1 + package.json | 2 +- src/yzhanweather.js | 3 +-- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 9e7d4e3..7d1f1ec 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ Pure CSS animation for sakura, rain, snow, firefly and butterfly effects, high p #### Node.js ```javascript npm i yzhanweather +import YZhanWeather from 'yzhanweather' ``` #### Browser ```html diff --git a/package.json b/package.json index ffa3a79..d7ea852 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "yzhanweather", - "version": "1.0.3", + "version": "1.0.4", "description": "Pure CSS animation for sakura, rain, snow, firefly and butterfly effects, high performance without affecting SEO. 纯 CSS 动画实现樱花、雨、雪、萤火虫和蝴蝶飞舞背景效果,高性能且不影响 SEO", "main": "docs/yzhanweather.min.js", "files": [ diff --git a/src/yzhanweather.js b/src/yzhanweather.js index fd37ff4..734fdd8 100644 --- a/src/yzhanweather.js +++ b/src/yzhanweather.js @@ -53,10 +53,9 @@ export default class { let {num, html, containerStyle, style, styles, keyframe = {}, keyframes} = CONF[type] this.createKeyfarme(keyframe) const keyframeNames = this.createKeyfarmes(keyframes) - if (typeof style === 'string') style = { '': style } + if (typeof style === 'string') style = { '': style } this.createStyles([style['']], n => '.' + (this.container.className = n) + ' div', keyframeNames) this.createStyles([containerStyle], _ => '.' + this.container.className, keyframeNames) - delete style[''] this.createRule(style, n => '.' + this.container.className + ' div' + (n[0] === ':' ? '' : ' ') + n) this.replaceStyles(styles, config) const classNames = this.createStyles(styles, n => ' .' + this.container.className + ' .' + n, keyframeNames)