@wufengtech/bbs-util v0.0.69
BBS Util
Requirement
- 编辑器依赖
element-ui
,Vue
需要配置Vue.use(ElementUI)
- axios 需要配置好 baseURL
Editor
import { setup, init, destroy, setErrorMsg } from "@wufengtech/bbs-util/lib/editor"
import "@wufengtech/bbs-util/lib/editor/index.css"
setup({
axios, // axios 对象
Vue, // Vue 对象
$confirm, // 参考 element this.$confirm 接口
$toast, // string => null 错误提示
$loading, // 参考 element this.$loading 接口
imgURLPrefix, // oss 前缀
})
init(
document.querySelector(".editor-container"),
defaultValue = null, // YouxiDoc 初始文档,可以传 null
onChange = null, // (originValue slate内部文档结构, YouxiDoc 文档结构) => {}
{
userID: string = null, // 不传 userID 则以下额外功能都会关闭,也不会缓存用户最近插入信息
gameID: string = null, // 如果需要开启 @ 或者阵容,必须传入游戏 ID
atEnabled: bool = false, // 是否开启 @ 功能
squadEnabled: bool = false, // 是否开启插入阵容功能
watermarkEnable: bool = false, // 水印开关
}, // optional
)
Renderer
PC 端 container class .editor.renderer-pc
Mobile 端 container class editor.renderer-mobile
分享页 container class editor.renderer-mobile.renderer-share-page
import { setup, renderPC, renderMobile, renderSharePage } from "@wufengtech/bbs-util/lib/renderer"
import "@wufengtech/bbs-util/lib/renderer/index.css"
setup({axios})
renderPC(YouxiDoc) => html
renderMobile(YouxiDoc) => html
renderSharePage(YouxiDoc) => html
Tooltip
import { setup, init, destroy } from "@wufengtech/bbs-util/lib/tooltip"
import "@wufengtech/bbs-util/lib/tooltip/index.css"
setup({axios})
// 开启后, 设置了以下 dom 属性会触发 tooltip
// class: [editor__item, editor__champion, editor__talent, editor__synergy]
// <div
// data-no=""
// data-gameid=""
// data-version=""
// disableclick="" 是否关闭点击跳转 wiki 功能
// ></div>
init()
// 调用后,关闭 tooltip 功能
destroy()
Common
import { getArticleRenderConfig } from "@wufengtech/bbs-util/lib/common"
getArticleRenderConfig(article 后端返回的 article 详情数据, isMyArticle: 是否是自己的文章) => {
hint: HTML string // 文章状态的提示信息,为 "" 时不显示
show: bool // 是否显示文章
}
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago