Getting Started
Let’s get started with mt-v-safe-html.
Play online
You can start playing with mt-v-safe-html in your browser using Stackblitz:
Play on StackBlitz
Installation
- Install the dependencies in the
docs
folder:
npm install --save mt-v-safe-html
yarn add mt-v-safe-html
pnpm add mt-v-safe-html
Usage Example
This page is a very basic usage example, for more amazing usage, please reference next page.
Global usage
safeHtml
// main.ts
import { createApp } from 'vue'
import { createSafeHtml } from 'mt-v-safe-html'
import App from './App.vue'
createApp(App)
.use(createSafeHtml, { defaultString: 'Please update your text' })
.mount('#app')
<template>
<div v-html="$safeHtml('<div>something</div></div>')"></div>
<div v-html="$safeHtml(() => $t('contact-us'))"></div>
</template>