Giter VIP home page Giter VIP logo

markdowneditor-using-vue3-'s Introduction

Vue3Learning-MarkDown编辑器

环境配置

npm init vite-app

npm i

npm i marked

npm i lodash-es

主要代码

const input = ref('# hello')

定义了一个名为 ‘input’ 的响应式变量,初值为 '# hello',这是一个以 markdown 格式的字符串。

const output = computed(() => marked(input.value))

‘output’ 是一个计算属性,它包含了从 markdown 语法解析出来的 HTML。每当 ‘input’ 变化时,‘output’ 会自动更新。

const update = debounce((e) => { input.value = e.target.value })

‘update’ 函数被去抖,也就是说它不会立即执行。相反,它会在最后一次被触发后的一段指定时间过去之后才被执行。这在如实时搜索结果这样的场景中是有用的,因为你不希望函数随着用户的输入而不断执行。这里,‘update’ 函数会把 ‘input’ 的值更新为事件 ‘e’ 的值。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.