Commit 6c97e57a80fdc5e339cc5ad9070c2ce728194ac7
1 parent
a3f7e0d2
fixed #1399
Showing
3 changed files
with
410 additions
and
131 deletions
Show diff stats
examples/routers/switch.vue
1 | 1 | <template> |
2 | 2 | <div> |
3 | - <i-switch v-model="m1"> | |
3 | + <i-switch v-model="m1" :true-value="1" :false-value="0"> | |
4 | 4 | <span slot="open">开</span> |
5 | 5 | <span slot="close">关</span> |
6 | 6 | </i-switch> |
7 | 7 | {{ m1 }} |
8 | - <div @click="m1 = !m1">toggle</div> | |
8 | + <div @click="m1 = 0">toggle</div> | |
9 | 9 | </div> |
10 | 10 | </template> |
11 | 11 | <script> |
12 | 12 | export default { |
13 | 13 | data () { |
14 | 14 | return { |
15 | - m1: false | |
15 | + m1: 1 | |
16 | 16 | } |
17 | 17 | }, |
18 | 18 | methods: { | ... | ... |
package-lock.json
1 | 1 | { |
2 | 2 | "name": "iview", |
3 | - "version": "2.1.0", | |
3 | + "version": "2.2.0", | |
4 | 4 | "lockfileVersion": 1, |
5 | 5 | "requires": true, |
6 | 6 | "dependencies": { |
... | ... | @@ -197,6 +197,16 @@ |
197 | 197 | "integrity": "sha1-Qmu52oQJDBg42BLIFQryCoMx4pY=", |
198 | 198 | "dev": true |
199 | 199 | }, |
200 | + "array-includes": { | |
201 | + "version": "3.0.3", | |
202 | + "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.0.3.tgz", | |
203 | + "integrity": "sha1-GEtI9i2S10UrsxsyMWXH+L0CJm0=", | |
204 | + "dev": true, | |
205 | + "requires": { | |
206 | + "define-properties": "1.1.2", | |
207 | + "es-abstract": "1.8.1" | |
208 | + } | |
209 | + }, | |
200 | 210 | "array-slice": { |
201 | 211 | "version": "0.2.3", |
202 | 212 | "resolved": "https://registry.npmjs.org/array-slice/-/array-slice-0.2.3.tgz", |
... | ... | @@ -236,6 +246,12 @@ |
236 | 246 | "integrity": "sha1-iYUI2iIm84DfkEcoRWhJwVAaSw0=", |
237 | 247 | "dev": true |
238 | 248 | }, |
249 | + "asap": { | |
250 | + "version": "2.0.6", | |
251 | + "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", | |
252 | + "integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=", | |
253 | + "dev": true | |
254 | + }, | |
239 | 255 | "asn1.js": { |
240 | 256 | "version": "4.9.1", |
241 | 257 | "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.9.1.tgz", |
... | ... | @@ -587,6 +603,17 @@ |
587 | 603 | "trim-right": "1.0.1" |
588 | 604 | } |
589 | 605 | }, |
606 | + "babel-helper-builder-binary-assignment-operator-visitor": { | |
607 | + "version": "6.24.1", | |
608 | + "resolved": "https://registry.npmjs.org/babel-helper-builder-binary-assignment-operator-visitor/-/babel-helper-builder-binary-assignment-operator-visitor-6.24.1.tgz", | |
609 | + "integrity": "sha1-zORReto1b0IgvK6KAsKzRvmlZmQ=", | |
610 | + "dev": true, | |
611 | + "requires": { | |
612 | + "babel-helper-explode-assignable-expression": "6.24.1", | |
613 | + "babel-runtime": "6.23.0", | |
614 | + "babel-types": "6.25.0" | |
615 | + } | |
616 | + }, | |
590 | 617 | "babel-helper-call-delegate": { |
591 | 618 | "version": "6.24.1", |
592 | 619 | "resolved": "https://registry.npmjs.org/babel-helper-call-delegate/-/babel-helper-call-delegate-6.24.1.tgz", |
... | ... | @@ -611,6 +638,17 @@ |
611 | 638 | "lodash": "4.17.4" |
612 | 639 | } |
613 | 640 | }, |
641 | + "babel-helper-explode-assignable-expression": { | |
642 | + "version": "6.24.1", | |
643 | + "resolved": "https://registry.npmjs.org/babel-helper-explode-assignable-expression/-/babel-helper-explode-assignable-expression-6.24.1.tgz", | |
644 | + "integrity": "sha1-8luCz33BBDPFX3BZLVdGQArCLKo=", | |
645 | + "dev": true, | |
646 | + "requires": { | |
647 | + "babel-runtime": "6.23.0", | |
648 | + "babel-traverse": "6.25.0", | |
649 | + "babel-types": "6.25.0" | |
650 | + } | |
651 | + }, | |
614 | 652 | "babel-helper-function-name": { |
615 | 653 | "version": "6.24.1", |
616 | 654 | "resolved": "https://registry.npmjs.org/babel-helper-function-name/-/babel-helper-function-name-6.24.1.tgz", |
... | ... | @@ -665,6 +703,19 @@ |
665 | 703 | "lodash": "4.17.4" |
666 | 704 | } |
667 | 705 | }, |
706 | + "babel-helper-remap-async-to-generator": { | |
707 | + "version": "6.24.1", | |
708 | + "resolved": "https://registry.npmjs.org/babel-helper-remap-async-to-generator/-/babel-helper-remap-async-to-generator-6.24.1.tgz", | |
709 | + "integrity": "sha1-XsWBgnrXI/7N04HxySg5BnbkVRs=", | |
710 | + "dev": true, | |
711 | + "requires": { | |
712 | + "babel-helper-function-name": "6.24.1", | |
713 | + "babel-runtime": "6.23.0", | |
714 | + "babel-template": "6.25.0", | |
715 | + "babel-traverse": "6.25.0", | |
716 | + "babel-types": "6.25.0" | |
717 | + } | |
718 | + }, | |
668 | 719 | "babel-helper-replace-supers": { |
669 | 720 | "version": "6.24.1", |
670 | 721 | "resolved": "https://registry.npmjs.org/babel-helper-replace-supers/-/babel-helper-replace-supers-6.24.1.tgz", |
... | ... | @@ -719,6 +770,58 @@ |
719 | 770 | "babel-runtime": "6.23.0" |
720 | 771 | } |
721 | 772 | }, |
773 | + "babel-plugin-syntax-async-functions": { | |
774 | + "version": "6.13.0", | |
775 | + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-functions/-/babel-plugin-syntax-async-functions-6.13.0.tgz", | |
776 | + "integrity": "sha1-ytnK0RkbWtY0vzCuCHI5HgZHvpU=", | |
777 | + "dev": true | |
778 | + }, | |
779 | + "babel-plugin-syntax-async-generators": { | |
780 | + "version": "6.13.0", | |
781 | + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-async-generators/-/babel-plugin-syntax-async-generators-6.13.0.tgz", | |
782 | + "integrity": "sha1-a8lj67FuzLrmuStZbrfzXDQqi5o=", | |
783 | + "dev": true | |
784 | + }, | |
785 | + "babel-plugin-syntax-exponentiation-operator": { | |
786 | + "version": "6.13.0", | |
787 | + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-exponentiation-operator/-/babel-plugin-syntax-exponentiation-operator-6.13.0.tgz", | |
788 | + "integrity": "sha1-nufoM3KQ2pUoggGmpX9BcDF4MN4=", | |
789 | + "dev": true | |
790 | + }, | |
791 | + "babel-plugin-syntax-object-rest-spread": { | |
792 | + "version": "6.13.0", | |
793 | + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-object-rest-spread/-/babel-plugin-syntax-object-rest-spread-6.13.0.tgz", | |
794 | + "integrity": "sha1-/WU28rzhODb/o6VFjEkDpZe7O/U=", | |
795 | + "dev": true | |
796 | + }, | |
797 | + "babel-plugin-syntax-trailing-function-commas": { | |
798 | + "version": "6.22.0", | |
799 | + "resolved": "https://registry.npmjs.org/babel-plugin-syntax-trailing-function-commas/-/babel-plugin-syntax-trailing-function-commas-6.22.0.tgz", | |
800 | + "integrity": "sha1-ugNgk3+NBuQBgKQ/4NVhb/9TLPM=", | |
801 | + "dev": true | |
802 | + }, | |
803 | + "babel-plugin-transform-async-generator-functions": { | |
804 | + "version": "6.24.1", | |
805 | + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-generator-functions/-/babel-plugin-transform-async-generator-functions-6.24.1.tgz", | |
806 | + "integrity": "sha1-8FiQAUX9PpkHpt3yjaWfIVJYpds=", | |
807 | + "dev": true, | |
808 | + "requires": { | |
809 | + "babel-helper-remap-async-to-generator": "6.24.1", | |
810 | + "babel-plugin-syntax-async-generators": "6.13.0", | |
811 | + "babel-runtime": "6.23.0" | |
812 | + } | |
813 | + }, | |
814 | + "babel-plugin-transform-async-to-generator": { | |
815 | + "version": "6.24.1", | |
816 | + "resolved": "https://registry.npmjs.org/babel-plugin-transform-async-to-generator/-/babel-plugin-transform-async-to-generator-6.24.1.tgz", | |
817 | + "integrity": "sha1-ZTbjeK/2yx1VF6wOQOs+n8jQh2E=", | |
818 | + "dev": true, | |
819 | + "requires": { | |
820 | + "babel-helper-remap-async-to-generator": "6.24.1", | |
821 | + "babel-plugin-syntax-async-functions": "6.13.0", | |
822 | + "babel-runtime": "6.23.0" | |
823 | + } | |
824 | + }, | |
722 | 825 | "babel-plugin-transform-es2015-arrow-functions": { |
723 | 826 | "version": "6.22.0", |
724 | 827 | "resolved": "https://registry.npmjs.org/babel-plugin-transform-es2015-arrow-functions/-/babel-plugin-transform-es2015-arrow-functions-6.22.0.tgz", |
... | ... | @@ -953,6 +1056,39 @@ |
953 | 1056 | "regexpu-core": "2.0.0" |
954 | 1057 | } |
955 | 1058 | }, |
1059 | + "babel-plugin-transform-exponentiation-operator": { | |
1060 | + "version": "6.24.1", | |
1061 | + "resolved": "https://registry.npmjs.org/babel-plugin-transform-exponentiation-operator/-/babel-plugin-transform-exponentiation-operator-6.24.1.tgz", | |
1062 | + "integrity": "sha1-KrDJx/MJj6SJB3cruBP+QejeOg4=", | |
1063 | + "dev": true, | |
1064 | + "requires": { | |
1065 | + "babel-helper-builder-binary-assignment-operator-visitor": "6.24.1", | |
1066 | + "babel-plugin-syntax-exponentiation-operator": "6.13.0", | |
1067 | + "babel-runtime": "6.23.0" | |
1068 | + } | |
1069 | + }, | |
1070 | + "babel-plugin-transform-object-rest-spread": { | |
1071 | + "version": "6.26.0", | |
1072 | + "resolved": "https://registry.npmjs.org/babel-plugin-transform-object-rest-spread/-/babel-plugin-transform-object-rest-spread-6.26.0.tgz", | |
1073 | + "integrity": "sha1-DzZpLVD+9rfi1LOsFHgTepY7ewY=", | |
1074 | + "dev": true, | |
1075 | + "requires": { | |
1076 | + "babel-plugin-syntax-object-rest-spread": "6.13.0", | |
1077 | + "babel-runtime": "6.26.0" | |
1078 | + }, | |
1079 | + "dependencies": { | |
1080 | + "babel-runtime": { | |
1081 | + "version": "6.26.0", | |
1082 | + "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz", | |
1083 | + "integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=", | |
1084 | + "dev": true, | |
1085 | + "requires": { | |
1086 | + "core-js": "2.5.1", | |
1087 | + "regenerator-runtime": "0.11.0" | |
1088 | + } | |
1089 | + } | |
1090 | + } | |
1091 | + }, | |
956 | 1092 | "babel-plugin-transform-regenerator": { |
957 | 1093 | "version": "6.24.1", |
958 | 1094 | "resolved": "https://registry.npmjs.org/babel-plugin-transform-regenerator/-/babel-plugin-transform-regenerator-6.24.1.tgz", |
... | ... | @@ -1013,6 +1149,19 @@ |
1013 | 1149 | "babel-plugin-transform-regenerator": "6.24.1" |
1014 | 1150 | } |
1015 | 1151 | }, |
1152 | + "babel-preset-stage-3": { | |
1153 | + "version": "6.24.1", | |
1154 | + "resolved": "https://registry.npmjs.org/babel-preset-stage-3/-/babel-preset-stage-3-6.24.1.tgz", | |
1155 | + "integrity": "sha1-g2raCp56f6N8sTj7kyb4eTSkg5U=", | |
1156 | + "dev": true, | |
1157 | + "requires": { | |
1158 | + "babel-plugin-syntax-trailing-function-commas": "6.22.0", | |
1159 | + "babel-plugin-transform-async-generator-functions": "6.24.1", | |
1160 | + "babel-plugin-transform-async-to-generator": "6.24.1", | |
1161 | + "babel-plugin-transform-exponentiation-operator": "6.24.1", | |
1162 | + "babel-plugin-transform-object-rest-spread": "6.26.0" | |
1163 | + } | |
1164 | + }, | |
1016 | 1165 | "babel-register": { |
1017 | 1166 | "version": "6.24.1", |
1018 | 1167 | "resolved": "https://registry.npmjs.org/babel-register/-/babel-register-6.24.1.tgz", |
... | ... | @@ -1021,7 +1170,7 @@ |
1021 | 1170 | "requires": { |
1022 | 1171 | "babel-core": "6.25.0", |
1023 | 1172 | "babel-runtime": "6.23.0", |
1024 | - "core-js": "2.4.1", | |
1173 | + "core-js": "2.5.1", | |
1025 | 1174 | "home-or-tmp": "2.0.0", |
1026 | 1175 | "lodash": "4.17.4", |
1027 | 1176 | "mkdirp": "0.5.1", |
... | ... | @@ -1033,7 +1182,7 @@ |
1033 | 1182 | "resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.23.0.tgz", |
1034 | 1183 | "integrity": "sha1-CpSJ8UTecO+zzkMArM2zKeL8VDs=", |
1035 | 1184 | "requires": { |
1036 | - "core-js": "2.4.1", | |
1185 | + "core-js": "2.5.1", | |
1037 | 1186 | "regenerator-runtime": "0.10.3" |
1038 | 1187 | }, |
1039 | 1188 | "dependencies": { |
... | ... | @@ -1776,9 +1925,9 @@ |
1776 | 1925 | "dev": true |
1777 | 1926 | }, |
1778 | 1927 | "core-js": { |
1779 | - "version": "2.4.1", | |
1780 | - "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.4.1.tgz", | |
1781 | - "integrity": "sha1-TekR5mew6ukSTjQlS1OupvxhjT4=" | |
1928 | + "version": "2.5.1", | |
1929 | + "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.1.tgz", | |
1930 | + "integrity": "sha1-rmh03GaTd4m4B1T/VCjfZoGcpQs=" | |
1782 | 1931 | }, |
1783 | 1932 | "core-util-is": { |
1784 | 1933 | "version": "1.0.2", |
... | ... | @@ -3402,6 +3551,16 @@ |
3402 | 3551 | "resolved": "https://registry.npmjs.org/deepmerge/-/deepmerge-1.5.0.tgz", |
3403 | 3552 | "integrity": "sha512-Hm4+NyDQGgH3oYhKqR0gd99veBBZpnEUNoEfFl+3PRkQL+LKGJEBgqimeofAWzUn6aBzcaYPJrRigto/WfDzTg==" |
3404 | 3553 | }, |
3554 | + "define-properties": { | |
3555 | + "version": "1.1.2", | |
3556 | + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.2.tgz", | |
3557 | + "integrity": "sha1-g6c/L+pWmJj7c3GTyPhzyvbUXJQ=", | |
3558 | + "dev": true, | |
3559 | + "requires": { | |
3560 | + "foreach": "2.0.5", | |
3561 | + "object-keys": "1.0.11" | |
3562 | + } | |
3563 | + }, | |
3405 | 3564 | "del": { |
3406 | 3565 | "version": "2.2.2", |
3407 | 3566 | "resolved": "https://registry.npmjs.org/del/-/del-2.2.2.tgz", |
... | ... | @@ -3681,6 +3840,15 @@ |
3681 | 3840 | "integrity": "sha1-eePVhlU0aQn+bw9Fpd5oEDspTSA=", |
3682 | 3841 | "dev": true |
3683 | 3842 | }, |
3843 | + "encoding": { | |
3844 | + "version": "0.1.12", | |
3845 | + "resolved": "https://registry.npmjs.org/encoding/-/encoding-0.1.12.tgz", | |
3846 | + "integrity": "sha1-U4tm8+5izRq1HsMjgp0flIDHS+s=", | |
3847 | + "dev": true, | |
3848 | + "requires": { | |
3849 | + "iconv-lite": "0.4.15" | |
3850 | + } | |
3851 | + }, | |
3684 | 3852 | "engine.io": { |
3685 | 3853 | "version": "1.8.3", |
3686 | 3854 | "resolved": "https://registry.npmjs.org/engine.io/-/engine.io-1.8.3.tgz", |
... | ... | @@ -3811,6 +3979,30 @@ |
3811 | 3979 | "is-arrayish": "0.2.1" |
3812 | 3980 | } |
3813 | 3981 | }, |
3982 | + "es-abstract": { | |
3983 | + "version": "1.8.1", | |
3984 | + "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.8.1.tgz", | |
3985 | + "integrity": "sha512-G6pkMLdmxF3dh4hbuYuQiku29rRqo9p5+iRf7mZTEELT/xZ/D9Vzg04ddlvzJuJuCmZp1WBbfbVLZEeygYNkpw==", | |
3986 | + "dev": true, | |
3987 | + "requires": { | |
3988 | + "es-to-primitive": "1.1.1", | |
3989 | + "function-bind": "1.1.1", | |
3990 | + "has": "1.0.1", | |
3991 | + "is-callable": "1.1.3", | |
3992 | + "is-regex": "1.0.4" | |
3993 | + } | |
3994 | + }, | |
3995 | + "es-to-primitive": { | |
3996 | + "version": "1.1.1", | |
3997 | + "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.1.1.tgz", | |
3998 | + "integrity": "sha1-RTVSSKiJeQNLZ5Lhm7gfK3l13Q0=", | |
3999 | + "dev": true, | |
4000 | + "requires": { | |
4001 | + "is-callable": "1.1.3", | |
4002 | + "is-date-object": "1.0.1", | |
4003 | + "is-symbol": "1.0.1" | |
4004 | + } | |
4005 | + }, | |
3814 | 4006 | "es5-ext": { |
3815 | 4007 | "version": "0.10.24", |
3816 | 4008 | "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.24.tgz", |
... | ... | @@ -3948,15 +4140,47 @@ |
3948 | 4140 | "user-home": "2.0.0" |
3949 | 4141 | } |
3950 | 4142 | }, |
3951 | - "eslint-plugin-html": { | |
3952 | - "version": "1.7.0", | |
3953 | - "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-1.7.0.tgz", | |
3954 | - "integrity": "sha1-KlsDiE2NVq35rZhk6cA2SA+2Kck=", | |
4143 | + "eslint-plugin-react": { | |
4144 | + "version": "7.3.0", | |
4145 | + "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.3.0.tgz", | |
4146 | + "integrity": "sha512-7L6QEOxm7XhcDoe+U9Qt7GJjU6KeQOX9jCLGE8EPGF6FQbwZ9LgcBzsjXIZv9oYvNQlvQZmLjJs76xEeWsI4QA==", | |
4147 | + "dev": true, | |
4148 | + "requires": { | |
4149 | + "doctrine": "2.0.0", | |
4150 | + "has": "1.0.1", | |
4151 | + "jsx-ast-utils": "2.0.1", | |
4152 | + "prop-types": "15.5.10" | |
4153 | + } | |
4154 | + }, | |
4155 | + "eslint-plugin-vue": { | |
4156 | + "version": "2.1.0", | |
4157 | + "resolved": "https://registry.npmjs.org/eslint-plugin-vue/-/eslint-plugin-vue-2.1.0.tgz", | |
4158 | + "integrity": "sha1-UO0LfpojidkOaJdDo8wmtQJEG2k=", | |
3955 | 4159 | "dev": true, |
3956 | 4160 | "requires": { |
3957 | - "htmlparser2": "3.9.2" | |
4161 | + "eslint-plugin-html": "3.2.1", | |
4162 | + "eslint-plugin-react": "7.3.0" | |
3958 | 4163 | }, |
3959 | 4164 | "dependencies": { |
4165 | + "domhandler": { | |
4166 | + "version": "2.4.1", | |
4167 | + "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.4.1.tgz", | |
4168 | + "integrity": "sha1-iS5HAAqZvlW783dP/qBWHYh5wlk=", | |
4169 | + "dev": true, | |
4170 | + "requires": { | |
4171 | + "domelementtype": "1.3.0" | |
4172 | + } | |
4173 | + }, | |
4174 | + "eslint-plugin-html": { | |
4175 | + "version": "3.2.1", | |
4176 | + "resolved": "https://registry.npmjs.org/eslint-plugin-html/-/eslint-plugin-html-3.2.1.tgz", | |
4177 | + "integrity": "sha512-zxcArJx7QTqE0Stm5BMpk1cuYwOxLecqKMqEYabRcvqImDrjcRdQVdXT5RtqFHdH1aVD2akzHe+/Q5Wou6Jvaw==", | |
4178 | + "dev": true, | |
4179 | + "requires": { | |
4180 | + "htmlparser2": "3.9.2", | |
4181 | + "semver": "5.4.1" | |
4182 | + } | |
4183 | + }, | |
3960 | 4184 | "htmlparser2": { |
3961 | 4185 | "version": "3.9.2", |
3962 | 4186 | "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.9.2.tgz", |
... | ... | @@ -3964,124 +4188,18 @@ |
3964 | 4188 | "dev": true, |
3965 | 4189 | "requires": { |
3966 | 4190 | "domelementtype": "1.3.0", |
3967 | - "domhandler": "2.3.0", | |
4191 | + "domhandler": "2.4.1", | |
3968 | 4192 | "domutils": "1.5.1", |
3969 | 4193 | "entities": "1.1.1", |
3970 | 4194 | "inherits": "2.0.3", |
3971 | - "readable-stream": "2.2.3" | |
3972 | - }, | |
3973 | - "dependencies": { | |
3974 | - "domelementtype": { | |
3975 | - "version": "1.3.0", | |
3976 | - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz", | |
3977 | - "integrity": "sha1-sXrtguirWeUt2cGbF1bg/BhyBMI=", | |
3978 | - "dev": true | |
3979 | - }, | |
3980 | - "domhandler": { | |
3981 | - "version": "2.3.0", | |
3982 | - "resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz", | |
3983 | - "integrity": "sha1-LeWaCCLVAn+r/28DLCsloqir5zg=", | |
3984 | - "dev": true, | |
3985 | - "requires": { | |
3986 | - "domelementtype": "1.3.0" | |
3987 | - } | |
3988 | - }, | |
3989 | - "domutils": { | |
3990 | - "version": "1.5.1", | |
3991 | - "resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz", | |
3992 | - "integrity": "sha1-3NhIiib1Y9YQeeSMn3t+Mjc2gs8=", | |
3993 | - "dev": true, | |
3994 | - "requires": { | |
3995 | - "dom-serializer": "0.1.0", | |
3996 | - "domelementtype": "1.3.0" | |
3997 | - }, | |
3998 | - "dependencies": { | |
3999 | - "dom-serializer": { | |
4000 | - "version": "0.1.0", | |
4001 | - "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz", | |
4002 | - "integrity": "sha1-BzxpdUbOB4DOI75KKOKT5AvDDII=", | |
4003 | - "dev": true, | |
4004 | - "requires": { | |
4005 | - "domelementtype": "1.1.3", | |
4006 | - "entities": "1.1.1" | |
4007 | - }, | |
4008 | - "dependencies": { | |
4009 | - "domelementtype": { | |
4010 | - "version": "1.1.3", | |
4011 | - "resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz", | |
4012 | - "integrity": "sha1-vSh3PiZCiBrsUVRJJCmcXNgiGFs=", | |
4013 | - "dev": true | |
4014 | - } | |
4015 | - } | |
4016 | - } | |
4017 | - } | |
4018 | - }, | |
4019 | - "entities": { | |
4020 | - "version": "1.1.1", | |
4021 | - "resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz", | |
4022 | - "integrity": "sha1-blwtClYhtdra7O+AuQ7ftc13cvA=", | |
4023 | - "dev": true | |
4024 | - }, | |
4025 | - "inherits": { | |
4026 | - "version": "2.0.3", | |
4027 | - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", | |
4028 | - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", | |
4029 | - "dev": true | |
4030 | - }, | |
4031 | - "readable-stream": { | |
4032 | - "version": "2.2.3", | |
4033 | - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.2.3.tgz", | |
4034 | - "integrity": "sha1-nPSUY5hd8BbIrogTCXqSk6mzNyk=", | |
4035 | - "dev": true, | |
4036 | - "requires": { | |
4037 | - "buffer-shims": "1.0.0", | |
4038 | - "core-util-is": "1.0.2", | |
4039 | - "inherits": "2.0.3", | |
4040 | - "isarray": "1.0.0", | |
4041 | - "process-nextick-args": "1.0.7", | |
4042 | - "string_decoder": "0.10.31", | |
4043 | - "util-deprecate": "1.0.2" | |
4044 | - }, | |
4045 | - "dependencies": { | |
4046 | - "buffer-shims": { | |
4047 | - "version": "1.0.0", | |
4048 | - "resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz", | |
4049 | - "integrity": "sha1-mXjOMXOIxkmth5MCjDR37wRKi1E=", | |
4050 | - "dev": true | |
4051 | - }, | |
4052 | - "core-util-is": { | |
4053 | - "version": "1.0.2", | |
4054 | - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", | |
4055 | - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", | |
4056 | - "dev": true | |
4057 | - }, | |
4058 | - "isarray": { | |
4059 | - "version": "1.0.0", | |
4060 | - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", | |
4061 | - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", | |
4062 | - "dev": true | |
4063 | - }, | |
4064 | - "process-nextick-args": { | |
4065 | - "version": "1.0.7", | |
4066 | - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", | |
4067 | - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", | |
4068 | - "dev": true | |
4069 | - }, | |
4070 | - "string_decoder": { | |
4071 | - "version": "0.10.31", | |
4072 | - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz", | |
4073 | - "integrity": "sha1-YuIDvEF2bGwoyfyEMB2rHFMQ+pQ=", | |
4074 | - "dev": true | |
4075 | - }, | |
4076 | - "util-deprecate": { | |
4077 | - "version": "1.0.2", | |
4078 | - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", | |
4079 | - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", | |
4080 | - "dev": true | |
4081 | - } | |
4082 | - } | |
4083 | - } | |
4195 | + "readable-stream": "2.3.3" | |
4084 | 4196 | } |
4197 | + }, | |
4198 | + "semver": { | |
4199 | + "version": "5.4.1", | |
4200 | + "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", | |
4201 | + "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", | |
4202 | + "dev": true | |
4085 | 4203 | } |
4086 | 4204 | } |
4087 | 4205 | }, |
... | ... | @@ -4370,6 +4488,29 @@ |
4370 | 4488 | "websocket-driver": "0.6.5" |
4371 | 4489 | } |
4372 | 4490 | }, |
4491 | + "fbjs": { | |
4492 | + "version": "0.8.14", | |
4493 | + "resolved": "https://registry.npmjs.org/fbjs/-/fbjs-0.8.14.tgz", | |
4494 | + "integrity": "sha1-0dviviVMNakeCfMfnNUKQLKg7Rw=", | |
4495 | + "dev": true, | |
4496 | + "requires": { | |
4497 | + "core-js": "1.2.7", | |
4498 | + "isomorphic-fetch": "2.2.1", | |
4499 | + "loose-envify": "1.3.1", | |
4500 | + "object-assign": "4.1.1", | |
4501 | + "promise": "7.3.1", | |
4502 | + "setimmediate": "1.0.5", | |
4503 | + "ua-parser-js": "0.7.14" | |
4504 | + }, | |
4505 | + "dependencies": { | |
4506 | + "core-js": { | |
4507 | + "version": "1.2.7", | |
4508 | + "resolved": "https://registry.npmjs.org/core-js/-/core-js-1.2.7.tgz", | |
4509 | + "integrity": "sha1-ZSKUwUZR2yj6k70tX/KYOk8IxjY=", | |
4510 | + "dev": true | |
4511 | + } | |
4512 | + } | |
4513 | + }, | |
4373 | 4514 | "figures": { |
4374 | 4515 | "version": "1.7.0", |
4375 | 4516 | "resolved": "https://registry.npmjs.org/figures/-/figures-1.7.0.tgz", |
... | ... | @@ -4538,6 +4679,12 @@ |
4538 | 4679 | "for-in": "1.0.2" |
4539 | 4680 | } |
4540 | 4681 | }, |
4682 | + "foreach": { | |
4683 | + "version": "2.0.5", | |
4684 | + "resolved": "https://registry.npmjs.org/foreach/-/foreach-2.0.5.tgz", | |
4685 | + "integrity": "sha1-C+4AUBiusmDQo6865ljdATbsG5k=", | |
4686 | + "dev": true | |
4687 | + }, | |
4541 | 4688 | "forwarded": { |
4542 | 4689 | "version": "0.1.0", |
4543 | 4690 | "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.1.0.tgz", |
... | ... | @@ -5589,6 +5736,12 @@ |
5589 | 5736 | } |
5590 | 5737 | } |
5591 | 5738 | }, |
5739 | + "function-bind": { | |
5740 | + "version": "1.1.1", | |
5741 | + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", | |
5742 | + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==", | |
5743 | + "dev": true | |
5744 | + }, | |
5592 | 5745 | "generate-function": { |
5593 | 5746 | "version": "2.0.0", |
5594 | 5747 | "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.0.0.tgz", |
... | ... | @@ -8686,6 +8839,15 @@ |
8686 | 8839 | "integrity": "sha1-/Xqtcmvxpf0W38KbL3pmAdJxOcQ=", |
8687 | 8840 | "dev": true |
8688 | 8841 | }, |
8842 | + "has": { | |
8843 | + "version": "1.0.1", | |
8844 | + "resolved": "https://registry.npmjs.org/has/-/has-1.0.1.tgz", | |
8845 | + "integrity": "sha1-hGFzP1OLCDfJNh45qauelwTcLyg=", | |
8846 | + "dev": true, | |
8847 | + "requires": { | |
8848 | + "function-bind": "1.1.1" | |
8849 | + } | |
8850 | + }, | |
8689 | 8851 | "has-ansi": { |
8690 | 8852 | "version": "2.0.0", |
8691 | 8853 | "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", |
... | ... | @@ -9609,6 +9771,18 @@ |
9609 | 9771 | "builtin-modules": "1.1.1" |
9610 | 9772 | } |
9611 | 9773 | }, |
9774 | + "is-callable": { | |
9775 | + "version": "1.1.3", | |
9776 | + "resolved": "https://registry.npmjs.org/is-callable/-/is-callable-1.1.3.tgz", | |
9777 | + "integrity": "sha1-hut1OSgF3cM69xySoO7fdO52BLI=", | |
9778 | + "dev": true | |
9779 | + }, | |
9780 | + "is-date-object": { | |
9781 | + "version": "1.0.1", | |
9782 | + "resolved": "https://registry.npmjs.org/is-date-object/-/is-date-object-1.0.1.tgz", | |
9783 | + "integrity": "sha1-mqIOtq7rv/d/vTPnTKAbM1gdOhY=", | |
9784 | + "dev": true | |
9785 | + }, | |
9612 | 9786 | "is-directory": { |
9613 | 9787 | "version": "0.3.1", |
9614 | 9788 | "resolved": "https://registry.npmjs.org/is-directory/-/is-directory-0.3.1.tgz", |
... | ... | @@ -9732,6 +9906,15 @@ |
9732 | 9906 | "integrity": "sha1-V/4cTkhHTt1lsJkR8msc1Ald2oQ=", |
9733 | 9907 | "dev": true |
9734 | 9908 | }, |
9909 | + "is-regex": { | |
9910 | + "version": "1.0.4", | |
9911 | + "resolved": "https://registry.npmjs.org/is-regex/-/is-regex-1.0.4.tgz", | |
9912 | + "integrity": "sha1-VRdIm1RwkbCTDglWVM7SXul+lJE=", | |
9913 | + "dev": true, | |
9914 | + "requires": { | |
9915 | + "has": "1.0.1" | |
9916 | + } | |
9917 | + }, | |
9735 | 9918 | "is-resolvable": { |
9736 | 9919 | "version": "1.0.0", |
9737 | 9920 | "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.0.0.tgz", |
... | ... | @@ -9741,6 +9924,18 @@ |
9741 | 9924 | "tryit": "1.0.3" |
9742 | 9925 | } |
9743 | 9926 | }, |
9927 | + "is-stream": { | |
9928 | + "version": "1.1.0", | |
9929 | + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", | |
9930 | + "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", | |
9931 | + "dev": true | |
9932 | + }, | |
9933 | + "is-symbol": { | |
9934 | + "version": "1.0.1", | |
9935 | + "resolved": "https://registry.npmjs.org/is-symbol/-/is-symbol-1.0.1.tgz", | |
9936 | + "integrity": "sha1-PMWfAAJRlLarLjjbrmaJJWtmBXI=", | |
9937 | + "dev": true | |
9938 | + }, | |
9744 | 9939 | "is-utf8": { |
9745 | 9940 | "version": "0.2.1", |
9746 | 9941 | "resolved": "https://registry.npmjs.org/is-utf8/-/is-utf8-0.2.1.tgz", |
... | ... | @@ -9780,6 +9975,16 @@ |
9780 | 9975 | "isarray": "1.0.0" |
9781 | 9976 | } |
9782 | 9977 | }, |
9978 | + "isomorphic-fetch": { | |
9979 | + "version": "2.2.1", | |
9980 | + "resolved": "https://registry.npmjs.org/isomorphic-fetch/-/isomorphic-fetch-2.2.1.tgz", | |
9981 | + "integrity": "sha1-YRrhrPFPXoH3KVB0coGf6XM1WKk=", | |
9982 | + "dev": true, | |
9983 | + "requires": { | |
9984 | + "node-fetch": "1.7.2", | |
9985 | + "whatwg-fetch": "2.0.3" | |
9986 | + } | |
9987 | + }, | |
9783 | 9988 | "js-base64": { |
9784 | 9989 | "version": "2.1.9", |
9785 | 9990 | "resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.1.9.tgz", |
... | ... | @@ -9865,6 +10070,15 @@ |
9865 | 10070 | "integrity": "sha1-T9kss04OnbPInIYi7PUfm5eMbLk=", |
9866 | 10071 | "dev": true |
9867 | 10072 | }, |
10073 | + "jsx-ast-utils": { | |
10074 | + "version": "2.0.1", | |
10075 | + "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-2.0.1.tgz", | |
10076 | + "integrity": "sha1-6AGxs5mF4g//yHtA43SAgOLcrH8=", | |
10077 | + "dev": true, | |
10078 | + "requires": { | |
10079 | + "array-includes": "3.0.3" | |
10080 | + } | |
10081 | + }, | |
9868 | 10082 | "karma": { |
9869 | 10083 | "version": "1.7.0", |
9870 | 10084 | "resolved": "https://registry.npmjs.org/karma/-/karma-1.7.0.tgz", |
... | ... | @@ -9877,7 +10091,7 @@ |
9877 | 10091 | "colors": "1.1.2", |
9878 | 10092 | "combine-lists": "1.0.1", |
9879 | 10093 | "connect": "3.6.2", |
9880 | - "core-js": "2.4.1", | |
10094 | + "core-js": "2.5.1", | |
9881 | 10095 | "di": "0.0.1", |
9882 | 10096 | "dom-serialize": "2.2.1", |
9883 | 10097 | "expand-braces": "0.1.2", |
... | ... | @@ -12481,6 +12695,16 @@ |
12481 | 12695 | "lower-case": "1.1.4" |
12482 | 12696 | } |
12483 | 12697 | }, |
12698 | + "node-fetch": { | |
12699 | + "version": "1.7.2", | |
12700 | + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-1.7.2.tgz", | |
12701 | + "integrity": "sha512-xZZUq2yDhKMIn/UgG5q//IZSNLJIwW2QxS14CNH5spuiXkITM2pUitjdq58yLSaU7m4M0wBNaM2Gh/ggY4YJig==", | |
12702 | + "dev": true, | |
12703 | + "requires": { | |
12704 | + "encoding": "0.1.12", | |
12705 | + "is-stream": "1.1.0" | |
12706 | + } | |
12707 | + }, | |
12484 | 12708 | "node-forge": { |
12485 | 12709 | "version": "0.6.33", |
12486 | 12710 | "resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.6.33.tgz", |
... | ... | @@ -12589,6 +12813,12 @@ |
12589 | 12813 | "integrity": "sha1-8MaapQ78lbhmwYb0AKM3acsvEpE=", |
12590 | 12814 | "dev": true |
12591 | 12815 | }, |
12816 | + "object-keys": { | |
12817 | + "version": "1.0.11", | |
12818 | + "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.0.11.tgz", | |
12819 | + "integrity": "sha1-xUYBd4rVYPEULODgG8yotW0TQm0=", | |
12820 | + "dev": true | |
12821 | + }, | |
12592 | 12822 | "object.omit": { |
12593 | 12823 | "version": "2.0.1", |
12594 | 12824 | "resolved": "https://registry.npmjs.org/object.omit/-/object.omit-2.0.1.tgz", |
... | ... | @@ -13054,6 +13284,25 @@ |
13054 | 13284 | "integrity": "sha1-4mDHj2Fhzdmw5WzD4Khd4Xx6V74=", |
13055 | 13285 | "dev": true |
13056 | 13286 | }, |
13287 | + "promise": { | |
13288 | + "version": "7.3.1", | |
13289 | + "resolved": "https://registry.npmjs.org/promise/-/promise-7.3.1.tgz", | |
13290 | + "integrity": "sha512-nolQXZ/4L+bP/UGlkfaIujX9BKxGwmQ9OT4mOt5yvy8iK1h3wqTEJCijzGANTCCl9nWjY41juyAn2K3Q1hLLTg==", | |
13291 | + "dev": true, | |
13292 | + "requires": { | |
13293 | + "asap": "2.0.6" | |
13294 | + } | |
13295 | + }, | |
13296 | + "prop-types": { | |
13297 | + "version": "15.5.10", | |
13298 | + "resolved": "https://registry.npmjs.org/prop-types/-/prop-types-15.5.10.tgz", | |
13299 | + "integrity": "sha1-J5ffwxJhguOpXj37suiT3ddFYVQ=", | |
13300 | + "dev": true, | |
13301 | + "requires": { | |
13302 | + "fbjs": "0.8.14", | |
13303 | + "loose-envify": "1.3.1" | |
13304 | + } | |
13305 | + }, | |
13057 | 13306 | "proto-list": { |
13058 | 13307 | "version": "1.2.4", |
13059 | 13308 | "resolved": "https://registry.npmjs.org/proto-list/-/proto-list-1.2.4.tgz", |
... | ... | @@ -13282,6 +13531,12 @@ |
13282 | 13531 | "integrity": "sha1-0ZQcZ7rUN+G+dkM63Vs4X5WxkmA=", |
13283 | 13532 | "dev": true |
13284 | 13533 | }, |
13534 | + "regenerator-runtime": { | |
13535 | + "version": "0.11.0", | |
13536 | + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.0.tgz", | |
13537 | + "integrity": "sha512-/aA0kLeRb5N9K0d4fw7ooEbI+xDe+DKD499EQqygGqeS8N3xto15p09uY2xj7ixP81sNPXvRLnAQIqdVStgb1A==", | |
13538 | + "dev": true | |
13539 | + }, | |
13285 | 13540 | "regenerator-transform": { |
13286 | 13541 | "version": "0.9.11", |
13287 | 13542 | "resolved": "https://registry.npmjs.org/regenerator-transform/-/regenerator-transform-0.9.11.tgz", |
... | ... | @@ -14325,6 +14580,12 @@ |
14325 | 14580 | "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", |
14326 | 14581 | "dev": true |
14327 | 14582 | }, |
14583 | + "ua-parser-js": { | |
14584 | + "version": "0.7.14", | |
14585 | + "resolved": "https://registry.npmjs.org/ua-parser-js/-/ua-parser-js-0.7.14.tgz", | |
14586 | + "integrity": "sha1-EQ1T+kw/MmwSEpK76skE0uAzh8o=", | |
14587 | + "dev": true | |
14588 | + }, | |
14328 | 14589 | "uglify-js": { |
14329 | 14590 | "version": "2.8.29", |
14330 | 14591 | "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-2.8.29.tgz", |
... | ... | @@ -15558,6 +15819,12 @@ |
15558 | 15819 | "integrity": "sha1-domUmcGEtu91Q3fC27DNbLVdKec=", |
15559 | 15820 | "dev": true |
15560 | 15821 | }, |
15822 | + "whatwg-fetch": { | |
15823 | + "version": "2.0.3", | |
15824 | + "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.3.tgz", | |
15825 | + "integrity": "sha1-nITsLc9oGH/wC8ZOEnS0QhduHIQ=", | |
15826 | + "dev": true | |
15827 | + }, | |
15561 | 15828 | "when": { |
15562 | 15829 | "version": "3.7.8", |
15563 | 15830 | "resolved": "https://registry.npmjs.org/when/-/when-3.7.8.tgz", | ... | ... |
src/components/switch/switch.vue
... | ... | @@ -17,7 +17,15 @@ |
17 | 17 | mixins: [ Emitter ], |
18 | 18 | props: { |
19 | 19 | value: { |
20 | - type: Boolean, | |
20 | + type: [String, Number, Boolean], | |
21 | + default: false | |
22 | + }, | |
23 | + trueValue: { | |
24 | + type: [String, Number, Boolean], | |
25 | + default: true | |
26 | + }, | |
27 | + falseValue: { | |
28 | + type: [String, Number, Boolean], | |
21 | 29 | default: false |
22 | 30 | }, |
23 | 31 | disabled: { |
... | ... | @@ -56,7 +64,8 @@ |
56 | 64 | return false; |
57 | 65 | } |
58 | 66 | |
59 | - const checked = !this.currentValue; | |
67 | + const checked = this.currentValue === this.trueValue ? this.falseValue : this.trueValue; | |
68 | + | |
60 | 69 | this.currentValue = checked; |
61 | 70 | this.$emit('input', checked); |
62 | 71 | this.$emit('on-change', checked); |
... | ... | @@ -65,6 +74,9 @@ |
65 | 74 | }, |
66 | 75 | watch: { |
67 | 76 | value (val) { |
77 | + if (val !== this.trueValue && val !== this.falseValue) { | |
78 | + throw 'Value should be trueValue or falseValue.'; | |
79 | + } | |
68 | 80 | this.currentValue = val; |
69 | 81 | } |
70 | 82 | } | ... | ... |