🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

vue3-writer-views

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vue3-writer-views

A vue3 typewriter effect containing code highlights

1.0.1
npm
Version published
Weekly downloads
15
200%
Maintainers
1
Weekly downloads
 
Created
Source

vue3-writer-views 打字机插件库

介绍

vue3-writer-views 是一个vue3的基于chatgpt模式的打字机效果组件库,支持静态数据流,动态数据流,支持代码着色,代码复制,简化开发,

效果图

安装

npm install vue3-writer-views

or

pnpm install vue3-writer-views

API options

# 指令参数

export interface TypewriterOptions {
    privated?: boolean // 是否静态数据, 静态数据: 是一次获取的静态数据,非静态:频繁获取数据流的比如 res.body.getReader()
    text: string // 数据
    speed?: number // 打字速度,单位是毫秒
    cursor?: boolean // 是否显示光标
    isScrollToBottom?: boolean // 显示容器是否滚动到底部
}


# 参数增加
{
     className: {
         type: String,
         default: ""
     }
}

改变主题

import {setThemeStyle} from 'vue3-writer-views'
import {WriterCodeThemeLang,ThemeList} from 'vue3-writer-views/src/theme'
// WriterCodeThemeLang 类型
// ThemeList 所有主题可以for 循环
setThemeStyle("a11y-dark")

主题名称(ThemeList)

export type HighlightLanguage =
    | "a11y-dark"
    | "a11y-light"
    | "agate"
    | "an-old-hope"
    | "androidstudio"
    | "arduino-light"
    | "arta"
    | "ascetic"
    | "atom-one-dark-reasonable"
    | "atom-one-dark"
    | "atom-one-light"
    | "brown-paper"
    | "codepen-embed"
    | "color-brewer"
    | "dark"
    | "default"
    | "devibeans"
    | "docco"
    | "far"
    | "felipec"
    | "foundation"
    | "github-dark-dimmed"
    | "github-dark"
    | "github"
    | "gml"
    | "googlecode"
    | "gradient-dark"
    | "gradient-light"
    | "grayscale"
    | "hybrid"
    | "idea"
    | "intellij-light"
    | "ir-black"
    | "isbl-editor-dark"
    | "isbl-editor-light"
    | "kimbie-dark"
    | "kimbie-light"
    | "lightfair"
    | "lioshi"
    | "magula"
    | "mono-blue"
    | "monokai-sublime"
    | "monokai"
    | "night-owl"
    | "nnfx-dark"
    | "nnfx-light"
    | "nord"
    | "obsidian"
    | "panda-syntax-dark"
    | "panda-syntax-light"
    | "paraiso-dark"
    | "paraiso-light"
    | "pojoaque"
    | "purebasic"
    | "qtcreator-dark"
    | "qtcreator-light"
    | "rainbow"
    | "routeros"
    | "school-book"
    | "shades-of-purple"
    | "srcery"
    | "stackoverflow-dark"
    | "stackoverflow-light"
    | "sunburst"
    | "tokyo-night-dark"
    | "tokyo-night-light"
    | "tomorrow-night-blue"
    | "tomorrow-night-bright"
    | "vs"
    | "vs2015"
    | "xcode"
    | "xt256"



配置Options

1. 指令使用

import {VueTypeWriter} from 'vue3-writer-views'

const app = createApp(App)
app.directive("type-writer", VueTypeWriter)
app.mount("#app")

使用

定义数据

const staticText1 = `当然可以,请看下面的JavaScript代码示例:
\`\`\`javascript

function bubbleSort(arr) {
    var len = arr.length;
    for (var i = 0; i < len; i++) {
        for (var j = 0; j < len - 1 - i; j++) {
            if (arr[j] > arr[j + 1]) {
                var temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }
    return arr;
}

// 示例
var arr = [64, 34, 25, 12, 22, 11, 90];
console.log(bubbleSort(arr));
\`\`\`

使用

<div v-type-writer="{ text: staticText, privated: true, speed: 10 }"></div>

2.组件使用

import {VueTypeWriterView} from 'vue3-writer-views'

const app = createApp(App)
app.component(VueTypeWriterView.name, VueTypeWriterView)
app.mount("#app")

使用

 <VueWriterView :text="staticText" :privated="true" />

感谢您的使用

Keywords

vue3-writer-views

FAQs

Package last updated on 02 Apr 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts