checkbox component

This commit is contained in:
cookfront
2017-03-01 11:15:15 +08:00
parent 38d6771e72
commit e0be5b962e
14 changed files with 283 additions and 26 deletions
+7 -1
View File
@@ -15,6 +15,8 @@ import Panel from '../packages/panel/index.js';
import Card from '../packages/card/index.js';
import Steps from '../packages/steps/index.js';
import Tag from '../packages/tag/index.js';
import Checkbox from '../packages/checkbox/index.js';
import CheckboxGroup from '../packages/checkbox-group/index.js';
const install = function(Vue) {
if (install.installed) return;
@@ -34,6 +36,8 @@ const install = function(Vue) {
Vue.component(Card.name, Card);
Vue.component(Steps.name, Steps);
Vue.component(Tag.name, Tag);
Vue.component(Checkbox.name, Checkbox);
Vue.component(CheckboxGroup.name, CheckboxGroup);
};
// auto install
@@ -60,5 +64,7 @@ module.exports = {
Panel,
Card,
Steps,
Tag
Tag,
Checkbox,
CheckboxGroup
};
+22
View File
@@ -0,0 +1,22 @@
/**
* 根据父组件名找到对应`parent`
*/
export default {
methods: {
findParentByComponentName(name) {
if (this.parentGroup) return;
let parent = this.$parent;
while (parent) {
if (parent.$options.name === name) {
this.parentGroup = parent;
break;
} else {
parent = parent.$parent;
}
}
return this.parentGroup;
}
}
};