Skip to content

Commit 25a50bf

Browse files
committed
docs: add element-ui el-input demo, and recommend v-model on textarea, ref #89 #96
1 parent 14193c8 commit 25a50bf

File tree

5 files changed

+65
-6
lines changed

5 files changed

+65
-6
lines changed

README.md

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ Live Demo & Documentation: https://fritx.github.io/vue-at
1616
- [x] ContentEditable/Textarea
1717
- [x] Avatars, custom templates
1818
- [x] Vue2/Vue1
19+
- [x] Vuetify v-textarea
20+
- [x] Element el-input
1921

2022
See also: [react-at](https://github.com/fritx/react-at)
2123

@@ -63,16 +65,16 @@ export default {
6365

6466
## Using V-Model (Recommended)
6567

66-
Notice that `<editor v-model>` could be buggy,<br>
67-
and should be like `<at v-model><editor></at>` instead.
68+
~~Notice that `<editor v-model>` could be buggy,<br>
69+
and should be like `<at v-model><editor></at>` instead.~~
6870

6971
```vue
7072
<at v-model="html">
7173
<div contenteditable></div>
7274
</at>
7375
74-
<at-ta v-model="text">
75-
<textarea></textarea>
76+
<at-ta>
77+
<textarea v-model="text"></textarea>
7678
</at-ta>
7779
```
7880

@@ -154,3 +156,21 @@ This gives you the option of changing the style of inserted tagged items. It is
154156
<span class="tag"><img :src="s.current.avatar">{{ s.current.name }}</span>
155157
</span>
156158
```
159+
160+
### Vuetify v-textarea
161+
162+
```vue
163+
<at-ta :members="members">
164+
<!-- slots -->
165+
<v-textarea class="vuetify-editor" v-model="text"></v-textarea>
166+
</at-ta>
167+
```
168+
169+
### Element-UI el-input
170+
171+
```vue
172+
<at-ta :members="members" v-model="text">
173+
<!-- slots -->
174+
<el-input type="textarea" class="element-editor" v-model="text3"></el-input>
175+
</at-ta>
176+
```

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@
2222
"babel-preset-stage-0": "^6.16.0",
2323
"cross-env": "^3.0.0",
2424
"css-loader": "^0.25.0",
25+
"element-ui": "^2.8.2",
2526
"file-loader": "^0.9.0",
2627
"node-sass": "^4.12.0",
2728
"sass-loader": "^4.1.0",
2829
"style-loader": "^0.23.1",
2930
"textarea-caret": "^3.0.2",
3031
"uglifyjs-webpack-plugin": "^1.2.2",
32+
"url-loader": "^1.1.2",
3133
"vue": "^2.1.0",
3234
"vue-loader": "^10.3.0",
3335
"vue-style-loader": "^1.0.0",

src/App.vue

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,26 @@
4848
<textarea class="editor"></textarea>
4949
</at-ta>
5050

51-
<at-ta :members="members" name-key="name" v-model="text2">
51+
<at-ta :members="members" name-key="name">
5252
<!-- custom: with avatars -->
5353
<template slot="item" scope="s">
5454
<img :src="s.item.avatar">
5555
<span v-text="s.item.name"></span>
5656
</template>
5757

58-
<v-textarea class="vuetify-editor"></v-textarea>
58+
<v-textarea class="vuetify-editor" v-model="text2"></v-textarea>
59+
</at-ta>
60+
61+
<br />
62+
63+
<at-ta :members="members" name-key="name">
64+
<!-- custom: with avatars -->
65+
<template slot="item" scope="s">
66+
<img :src="s.item.avatar">
67+
<span v-text="s.item.name"></span>
68+
</template>
69+
70+
<el-input type="textarea" v-model="text3" class="element-editor"></el-input>
5971
</at-ta>
6072
</div>
6173
</template>
@@ -119,6 +131,7 @@ Playback - Video player.
119131
`.trim() // fix trailing abnormal nodes
120132
}
121133
data.text2 = data.text
134+
data.text3 = data.text
122135
data.html2 = data.html
123136
return data
124137
}
@@ -147,6 +160,10 @@ Playback - Video player.
147160
white-space: pre-wrap;
148161
border: solid 2px rgba(0,0,0,.5);
149162
}
163+
textarea {
164+
display: block;
165+
}
166+
150167
.vuetify-editor {
151168
width: 400px;
152169
margin: 0;
@@ -155,6 +172,19 @@ Playback - Video player.
155172
.vuetify-editor textarea {
156173
height: 200px;
157174
}
175+
.v-input__slot {
176+
margin: 0;
177+
}
178+
.v-text-field__details {
179+
display: none;
180+
}
181+
182+
.element-editor {
183+
width: 400px;
184+
}
185+
.element-editor textarea {
186+
height: 200px;
187+
}
158188
159189
.avatar {
160190
max-width: 1em;

src/main.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1+
import 'element-ui/lib/theme-chalk/index.css'
12
import 'vuetify/dist/vuetify.min.css'
23
import Vuetify from 'vuetify'
4+
import ElementUI from 'element-ui'
35
import Vue from 'vue'
46
import App from './App.vue'
57

68
Vue.use(Vuetify)
9+
Vue.use(ElementUI)
710

811
new Vue({
912
el: '#app',

webpack/base.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,10 @@ module.exports = {
2727
test: /\.css$/,
2828
loader: 'style-loader!css-loader'
2929
},
30+
{
31+
test: /\.(ttf|woff)$/,
32+
loader: 'url-loader'
33+
},
3034
{
3135
test: /\.(png|jpg|gif|svg)$/,
3236
loader: 'file-loader',

0 commit comments

Comments
 (0)