├── .npmignore
├── src
├── app.js
├── autosize-textarea.js
└── index.jade
├── webpack.config.js
├── index.js
├── index.html
├── .gitignore
├── package.json
├── README.md
└── gulpfile.babel.js
/.npmignore:
--------------------------------------------------------------------------------
1 | src/
2 | bundle.js
3 | index.html
4 | webpack.config.js
5 | gulpfile.js
--------------------------------------------------------------------------------
/src/app.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import autosizeTextarea from './autosize-textarea'
3 |
4 |
5 | new Vue({
6 | el: '#app',
7 | data () {
8 | return {
9 |
10 | }
11 | },
12 | methods: {
13 | onResized () {
14 | console.log('resized!')
15 | }
16 | },
17 | components: {
18 | 'autosize-textarea': autosizeTextarea
19 | }
20 | })
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | var path = require('path')
2 |
3 | module.exports = {
4 | entry: ['./src/app.js'],
5 | output: {
6 | path: path.resolve('.'),
7 | filename: 'bundle.js'
8 | },
9 | resolve: {
10 | extensions: ['', '.js']
11 | },
12 | module: {
13 | loaders: [
14 | { test: /\.js$/, loaders: ['babel'] }
15 | ]
16 | },
17 | plugins: []
18 | }
19 |
--------------------------------------------------------------------------------
/src/autosize-textarea.js:
--------------------------------------------------------------------------------
1 | import Vue from 'vue'
2 | import autosize from 'autosize'
3 |
4 | const template = ''
5 |
6 | const autosizeTextarea = Vue.extend({
7 | props: ['value', 'resized'],
8 | template: template,
9 | ready () {
10 | autosize(this.$el)
11 | if (this.resized) {
12 | this.$parent[this.resized](this.$el)
13 | }
14 | }
15 | })
16 |
17 | export default autosizeTextarea
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 | 'use strict';
2 |
3 | Object.defineProperty(exports, '__esModule', {
4 | value: true
5 | });
6 |
7 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
8 |
9 | var _vue = require('vue');
10 |
11 | var _vue2 = _interopRequireDefault(_vue);
12 |
13 | var autosizeTextarea = _vue2['default'].component('autosize-textarea', {});
14 |
15 | exports['default'] = autosizeTextarea;
16 | module.exports = exports['default'];
--------------------------------------------------------------------------------
/index.html:
--------------------------------------------------------------------------------
1 |
Autosize Textarea Component for Vue.JS<autosize-textarea></autosize-textarea>
autosize for Vue.js
--------------------------------------------------------------------------------
/src/index.jade:
--------------------------------------------------------------------------------
1 | doctype html
2 | html
3 | head
4 | meta(charset="utf-8")
5 | title Autosize Textarea Component for Vue.JS
6 | style.
7 | body {
8 | font: 14px/1.4 Helvetica, serif;
9 | }
10 | .container {
11 | max-width: 700px;
12 | margin: auto;
13 | }
14 | body
15 | .container
16 | h1.sitename <autosize-textarea></autosize-textarea>
17 | h2.slogan autosize for Vue.js
18 |
19 | #app
20 | autosize-textarea(rows="3" style="width:100%" value="some default value" resized="onResized")
21 | script(src="./bundle.js?t=#{time}")
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Logs
2 | logs
3 | *.log
4 |
5 | # Runtime data
6 | pids
7 | *.pid
8 | *.seed
9 |
10 | # Directory for instrumented libs generated by jscoverage/JSCover
11 | lib-cov
12 |
13 | # Coverage directory used by tools like istanbul
14 | coverage
15 |
16 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17 | .grunt
18 |
19 | # node-waf configuration
20 | .lock-wscript
21 |
22 | # Compiled binary addons (http://nodejs.org/api/addons.html)
23 | build/Release
24 |
25 | # Dependency directory
26 | # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
27 | node_modules
28 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "vue-autosize-textarea",
3 | "version": "0.0.1",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "author": "",
10 | "license": "ISC",
11 | "devDependencies": {
12 | "autosize": "^3.0.13",
13 | "babel-core": "^5.8.25",
14 | "babel-loader": "^5.3.2",
15 | "gulp": "^3.9.0",
16 | "gulp-babel": "^5.2.1",
17 | "gulp-jade": "^1.1.0",
18 | "gulp-rename": "^1.2.2",
19 | "gulp-serve": "^1.2.0",
20 | "gulp-util": "^3.0.6",
21 | "vue": "^0.12.16",
22 | "webpack": "^1.12.2"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | > This component is deprecated, since it's simple enough to use [autosize](http://www.jacklmoore.com/autosize/) directly, see details: https://github.com/egoist/vue-autosize-textarea/issues/1
2 |
3 | # vue-autosize-textarea
4 |
5 | Vue.js port of [Autosize](https://github.com/jackmoore/autosize)
6 |
7 | ## Usage with Webpack
8 |
9 | **Template**:
10 |
11 | ```html
12 |
15 |
16 | ```
17 |
18 | **Component**
19 |
20 | ```js
21 | import Vue from 'vue'
22 | import autosizeTextarea from 'vue-autosize-textarea'
23 |
24 | new Vue({
25 | el: '#app',
26 | methods: {
27 | onResized () {
28 | console.log('resized!')
29 | }
30 | },
31 | components: {
32 | 'autosize-textarea': autosizeTextarea
33 | }
34 | })
35 | ```
36 |
37 | **Demo**
38 |
39 | https://egoist.github.io/vue-autosize-textarea
40 |
41 | ## License
42 |
43 | MIT
44 |
--------------------------------------------------------------------------------
/gulpfile.babel.js:
--------------------------------------------------------------------------------
1 | import gulp from 'gulp'
2 | import serve from 'gulp-serve'
3 | import jade from 'gulp-jade'
4 | import babel from 'gulp-babel'
5 | import rename from 'gulp-rename'
6 | import gutil from 'gulp-util'
7 | import webpack from 'webpack'
8 | import webpackConfig from './webpack.config'
9 |
10 | const paths = {
11 | js: {
12 | babel: './src/autosize-textarea.js',
13 | webpack: ['./src/autosize-textarea.js', './src/app.js']
14 | },
15 | jade: {
16 | main: './src/index.jade'
17 | }
18 | }
19 |
20 | gulp.task('serve', serve({
21 | port: '3741',
22 | root: '.'
23 | }))
24 |
25 | gulp.task('jade', () => {
26 | gulp.src(paths.jade.main)
27 | .pipe(jade({
28 | locals:{
29 | time: Date.now()
30 | }
31 | }))
32 | .pipe(gulp.dest('.'))
33 | })
34 |
35 | gulp.task('babel', () => {
36 | gulp.src(paths.js.babel)
37 | .pipe(babel({stage: 0}))
38 | .pipe(rename('index.js'))
39 | .pipe(gulp.dest('.'))
40 | })
41 |
42 | let devConfig = {...webpackConfig}
43 | let devWebpack = webpack(devConfig)
44 |
45 | gulp.task('webpack-dev', (callback) => {
46 | devWebpack.run((err, stats) => {
47 | if(err) throw new gutil.PluginError("webpack:build-dev", err)
48 | gutil.log("[webpack:build-dev]", stats.toString({
49 | colors: true
50 | }))
51 | callback()
52 | })
53 | })
54 |
55 | gulp.task('watch-babel', () => {
56 | gulp.watch(paths.js.babel, ['babel'])
57 | })
58 |
59 | gulp.task('watch-webpack', () => {
60 | gulp.watch(paths.jade.main, ['jade'])
61 | gulp.watch(paths.js.webpack, ['webpack-dev'])
62 | })
63 |
64 | gulp.task('build', ['babel'])
65 |
66 | gulp.task('dev', ['jade', 'webpack-dev', 'serve', 'watch-webpack'])
67 |
68 | gulp.task('default', ['build', 'watch-babel'])
--------------------------------------------------------------------------------