Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Waline v3 的使用方式发生了变化,需要通过
import
引入并使用init
函数来初始化,而不是直接使用全局的Waline
对象。PR Type
Description
Waline v3的引入方式发生了变化,需要使用新的方式初始化,不然会报错
Waline ReferenceError: Waline is not defined
Changes
引入 Waline 样式:
保持样式的引入不变,依旧可以通过配置文件引入 Waline 的文件。
通过
import
方式加载 Waline 并使用init
:Waline.init
改为import { init } from '<%- theme.cdn.waline_js %>';
。init()
来初始化 Waline 评论系统。保留现有的配置和逻辑:
path
,locale
,imageUploader
等配置保留,并通过Object.assign()
合并这些配置传递给init()
。移除全局的
Waline
对象:由于
Waline
不再作为全局对象使用,直接通过import
后使用init
函数,解决了 "Waline is not defined" 的问题。