├── _config.yml
├── .gitignore
├── .travis.yml
├── src
├── index.js
└── vue-qs-form.vue
├── test
├── specs
│ └── vue-qs-form.spec.js
└── karma.config.js
├── webpack.config.js
├── LICENSE
├── README.md
├── package.json
├── docs
└── index.html
└── dist
└── vue-qs-form.min.js
/_config.yml:
--------------------------------------------------------------------------------
1 | theme: jekyll-theme-cayman
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | npm-debug.log
2 | yarn-error.log
3 | node_modules
4 | .DS_Store
5 | /test/coverage/
6 | /.vscode
7 | /.idea
8 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 |
3 | node_js:
4 | - "7"
5 |
6 | before_script:
7 | - yarn install
8 |
9 | script:
10 | - yarn run lint
11 | - yarn run test
12 | - yarn run report-coverage
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import component from './vue-qs-form.vue'
2 |
3 | const plugin = {
4 | install: Vue => {
5 | Vue.component(component.name, component)
6 | }
7 | }
8 |
9 | component.install = plugin.install
10 |
11 | export default component
12 |
--------------------------------------------------------------------------------
/test/specs/vue-qs-form.spec.js:
--------------------------------------------------------------------------------
1 | /* eslint-env mocha */
2 | import Vue from 'vue'
3 | import ElementUI from 'element-ui'
4 | import { expect } from 'chai'
5 | import { mount } from 'avoriaz'
6 | import vueQsForm from '@/vue-qs-form'
7 |
8 | Vue.use(ElementUI)
9 |
10 | describe('vue-birthday-input.vue', () => {
11 | it('data测试', () => {
12 | let data = [
13 | {
14 | key: 'qa1',
15 | title: '问题一',
16 | radios: [
17 | [0, '否'],
18 | [1, '是']
19 | ]
20 | },
21 | {
22 | key: 'qa2',
23 | title: '问题二',
24 | radios: [
25 | [0, '否'],
26 | [1, '是']
27 | ]
28 | }
29 | ]
30 | const wrapper = mount(vueQsForm, { propsData: { data: data }})
31 | let ret = JSON.stringify(wrapper.data().form)
32 |
33 | expect(ret).to.equal('{"qa1":"","qa2":""}')
34 | })
35 |
36 | })
37 |
--------------------------------------------------------------------------------
/webpack.config.js:
--------------------------------------------------------------------------------
1 | /* eslint-env node */
2 | const path = require('path')
3 | const CleanWebpackPlugin = require('clean-webpack-plugin')
4 |
5 | module.exports = {
6 | context: __dirname,
7 | resolve: {
8 | modules: [
9 | path.resolve(__dirname, 'src'),
10 | 'node_modules'
11 | ],
12 | alias: {
13 | 'vue$': 'vue/dist/vue.esm.js'
14 | },
15 | extensions: ['.js', '.json', '.vue']
16 | },
17 | entry: './src/index.js',
18 | externals: {
19 | },
20 | output: {
21 | path: path.resolve(__dirname, 'dist'),
22 | filename: "vue-qs-form.min.js",
23 | library: 'VueQsForm',
24 | libraryTarget: 'umd',
25 | umdNamedDefine: true
26 | },
27 | module: {
28 | rules: [
29 | {
30 | test: /\.vue$/,
31 | loader: 'vue-loader'
32 | },
33 | {
34 | test: /\.js$/,
35 | loader: 'babel-loader',
36 | exclude: path.resolve(__dirname, 'node_modules')
37 | }
38 | ]
39 | },
40 | plugins: [
41 | new CleanWebpackPlugin(['./dist'])
42 | ],
43 | devtool: false,
44 | performance: {
45 | hints: false
46 | }
47 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Kong Fanbo
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/test/karma.config.js:
--------------------------------------------------------------------------------
1 | /* eslint-env node, mocha */
2 | var path = require('path')
3 |
4 | module.exports = config => {
5 | config.set({
6 | browsers: ['PhantomJS'],
7 | frameworks: ['mocha', 'sinon-chai'],
8 | reporters: ['spec', 'coverage'],
9 | files: ['specs/*.spec.js'],
10 | preprocessors: {
11 | './specs/*.spec.js': ['webpack', 'sourcemap']
12 | },
13 | webpack: {
14 | devtool: '#inline-source-map',
15 | resolve: {
16 | extensions: ['.js', '.vue'],
17 | alias: {
18 | 'vue$': 'vue/dist/vue.esm.js',
19 | '@': path.resolve(__dirname, '../src')
20 | }
21 | },
22 | module: {
23 | rules: [
24 | {
25 | test: /\.vue$/,
26 | loader: 'vue-loader',
27 | options: {
28 | esModule: false
29 | }
30 | },
31 | {
32 | test: /\.js$/,
33 | loader: 'babel-loader',
34 | exclude: /node_modules/
35 | }
36 | ]
37 | }
38 | },
39 | webpackMiddleware: {
40 | noInfo: true
41 | },
42 | coverageReporter: {
43 | dir: './coverage',
44 | reporters: [
45 | { type: 'lcov', subdir: '.' },
46 | { type: 'text-summary' }
47 | ]
48 | },
49 | singleRun: true
50 | })
51 | }
52 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # vue-qs-form
2 | Vue quick step form, Vue快速问卷表单
3 |
4 | [](https://www.npmjs.com/package/vue-qs-form)
5 | [](https://www.npmjs.com/package/vue-qs-form)
6 | [](https://www.npmjs.com/package/vue-qs-form)
7 | [](https://travis-ci.org/xanke/vue-qs-form)
8 | [](https://codecov.io/gh/xanke/vue-qs-form)
9 | [](http://opensource.org/licenses/MIT)
10 |
11 | ****需配合element-ui使用 https://github.com/elemefe****
12 |
13 |
14 | ## 快速开始
15 | ```js
16 | import Vue from 'vue'
17 | import vueQsForm from 'vue-qs-form'
18 |
19 | export default {
20 | name: 'App',
21 |
22 | components: {
23 | vueQsForm
24 | }
25 | }
26 | ```
27 |
28 | ## 示例
29 | ```vue
30 |
31 |
30 |
31 |
{{item.title}}
7 |