Comparing version
{ | ||
"name": "vue-nl2br", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "A vue component that turns new lines into line breaks", | ||
"main": "index.js", | ||
"main": "./dist/vue-nl2br.js", | ||
"scripts": { | ||
"test": "echo \\\"Error: no test specified\\\" && exit 1" | ||
"test": "echo \\\"Error: no test specified\\\" && exit 1", | ||
"build": "webpack" | ||
}, | ||
@@ -14,3 +15,3 @@ "repository": { | ||
"keywords": [ | ||
"vue" | ||
"vue", "nl2br" | ||
], | ||
@@ -22,3 +23,11 @@ "author": "INOUE Takuya", | ||
}, | ||
"homepage": "https://github.com/inouetakuya/vue-nl2br#readme" | ||
"homepage": "https://github.com/inouetakuya/vue-nl2br#readme", | ||
"dependencies": { | ||
"vue": "^2.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-core": "^6.24.1", | ||
"babel-loader": "^7.0.0", | ||
"webpack": "^2.6.1" | ||
} | ||
} |
# vue-nl2br | ||
A vue component that turns new lines into line breaks | ||
A vue component that turns new lines into line breaks. | ||
## Requirement | ||
* [Vue.js](https://github.com/vuejs/vue) `^2.0.0` | ||
## Install | ||
```sh | ||
npm install --save vue-nl2br | ||
``` | ||
## Usage | ||
```html | ||
<nl2br tag="p" :content="`myLine1\nmyLine2`" /> | ||
``` | ||
is rendered to | ||
```html | ||
<p>myLine1<br>myLine2</p> | ||
``` | ||
### (1) To register a global component | ||
https://vuejs.org/v2/guide/components.html#Registration | ||
```js | ||
import Vue from 'vue' | ||
import Nl2br from 'vue-nl2br' | ||
Vue.component('nl2br', Nl2br) | ||
``` | ||
### (2) Local registration | ||
https://vuejs.org/v2/guide/components.html#Local-Registration | ||
```vue | ||
// MyComponent.vue | ||
<template> | ||
<nl2br tag="p" :content="`myLine1\nmyLine2`" /> | ||
</template> | ||
<script> | ||
import Nl2br from 'vue-nl2br' | ||
export default { | ||
name: 'my-component', | ||
components: { | ||
Nl2br, | ||
}, | ||
// ... | ||
} | ||
</script> | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
100801
473.68%15
50%155
15400%61
1933.33%0
-100%1
Infinity%3
Infinity%+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added
+ Added