0.1.0 • Published 2 years ago

@nx-space/nx-comments-wc v0.1.0

Weekly downloads
-
License
-
Repository
-
Last release
2 years ago

NEXT Comments WC. WIP

一个为 NEXT 前端主题打造的评论区 web component

A Comment Web Component for NEXT web

Usage

# pnpm manager (recommended)
pnpm i @nx-space/nx-comments-wc
# npm manager
npm i @nx-space/nx-comments-wc
# yarn manager
yarn add @nx-space/nx-comments-wc

By CDN

See demo/index.html

<!-- jsDelivr CDN -->
<script type="module" src="https://cdn.jsdelivr.net/npm/@nx-space/nx-comments-wc@latest"></script>

<nx-comments></nx-comments>

By npm

// main.ts
import '@nx-space/nx-comments-wc';
<nx-comments></nx-comments>

API

Example

<nx-comments owo=true apiUrl="https://api.example.com/api/v1/comments" pageSize=10 page=1 postId=".."></nx-comments>

src/nx-comments.ts:

class: NxComments

Superclass
NameModulePackage
LitElementlit
Fields
NamePrivacyTypeDefaultDescriptionInherited From
postIdstring"62d5235ff357ec0d12b68ea6"评论当前文章或页面的id
pageSizenumber10每页显示的评论数量
owoSelectorStateBoolean \| undefinedtrue是否开启 OwO 选择器
emojiSelectorStateBoolean \| undefinedtrue是否开启 Emoji 选择器
owoUrlstring \| undefinedOwO 表情配置文件链接
visitorAvatarUrlstring \| undefined`https://cravatar.cn/avatar/${this.email}?s=86&d=mm&r=g`游客默认头像链接
apiUrlstring'http://127.0.0.1:3333'服务端 API 链接
needCaptchaBoolean \| undefinedfalse是否需要算数验证(仅前端方面验证)
captchaRangenumber100算数验证范围(默认 从0到100)
pagenumber1当前评论列表的页码
parentnull当前回复评论的父级评论
Events
NameTypeDescriptionInherited From
change-comment-list-pageCustomEvent

Develop

pnpm ci # it can install dependencies with lock file

Custom Styles

全部类名与ID几乎都以 nx-comments- 开头,防止和其他组件冲突。

Stack

Reference

This Project refered to:

License

此项目 AGPLv3 授权开源,使用此项目进行的二次创作或者衍生项目也必须开源。

Author

nx-space © Wibus, Released under the AGPL-3.0 License. Created on 2022-7-27

Personal Website · Blog · GitHub @wibus-wee · Telegram @wibus✪