npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

gaoyia-parse

v1.2.0

Published

uParse修复版

Downloads

36

Readme

uParse 更新说明

uParse-提问反馈交流群 83254601【非uniapp官方】

1.2.0 修复了一些历史遗留问题

关于组件的一些说明

关于组件的一些说明:https://ask.dcloud.net.cn/article/36531

本组件修复自官方uParse

uParse 适用于 uni-app/mpvue 的富文本解析组件

支持 Html、Markdown 解析,Fork自: mpvue-wxParse

对于某些html标签不闭合等渲染有问题的

,如果是PHP推荐结合https://github.com/phith0n/XssHtml使用 $this->m_dom = new DOMDocument();

属性

| 名称 | 类型 | 默认值 | 描述 | | -----------------|--------------- | ------------- | ---------------- | | userSelect | String | text | none,text,all,element是否可选可复制| | imgOptions | Object | 参照组件源码和uni.previewImage文档| 把previewImage的选项拿出来| | loading | Boolean | false | 数据加载状态 | | className | String | — | 自定义 class 名称 | | content | String | — | 渲染内容 | | noData | String | 数据不能为空 | 空数据时的渲染展示 | | startHandler | Function | 见源码 | 自定义 parser 函数 | | endHandler | Function | null | 自定义 parser 函数 | | charsHandler | Function | null | 自定义 parser 函数 | | imageProp | Object||Boolean | 见下文 | 图片相关参数,当属性为任意布尔值时取消图片点击事件|

自定义 parser 函数具体介绍

  • 传入的参数为当前节点 node 对象及解析结果 results 对象,例如 startHandler(node, results)
  • 无需返回值,通过对传入的参数直接操作来完成需要的改动
  • 自定义函数会在原解析函数处理之后执行

imageProp 对象具体属性

| 名称 | 类型 | 默认值 | 描述 | | -----------------|--------------- | ------------- | ------------------ | | mode | String | 'aspectFit' | 图片裁剪、缩放的模式 | | padding | Number | 0 | 图片内边距 | | lazyLoad | Boolean | false | 图片懒加载 | | domain | String | '' | 图片服务域名 |

事件

| 名称 | 参数 | 描述 | | -----------------|----------------- | ---------------- | | preview | 图片地址,原始事件 | 预览图片时触发 | | navigate | 链接地址,原始事件 | 点击链接时触发 |

基本使用方法

<template>
  <div>
    <u-parse :content="article" @preview="preview" @navigate="navigate" />
  </div>
</template>

<script>
import uParse from '@/components/gaoyia-parse/parse.vue'

export default {
  components: {
    uParse
  },
  data () {
    return {
        article: '<p>html代码,具体参见https://github.com/gaoyia/parse/tree/1.0.7/parse-demo中的demo</p>'
    }
  },
  methods: {
    preview(src, e) {
      // do something
    },
    navigate(href, e) {
      // do something
    }
  }
}
</script>

//在APP.vue中引入,否则样式不能生效
<style>
@import url("/components/gaoyia-parse/parse.css");
</style>

渲染 Markdown

先将 markdown 转换为 html 即可

npm install marked
import marked from 'marked'
import uParse from '@/components/gaoyia-parse/parse.vue'

export default {
  components: {
    uParse
  },
  data () {
    return {
      article: marked(`#hello, markdown!`)
    }
  }
}