support Button and Icon

support Button and Icon
This commit is contained in:
梁灏 2017-03-01 14:43:27 +08:00
parent c755733a9c
commit d47ea998d6
6 changed files with 107 additions and 308 deletions

View file

@ -2,7 +2,7 @@
<button :type="htmlType" :class="classes" :disabled="disabled">
<Icon class="ivu-load-loop" type="load-c" v-if="loading"></Icon>
<Icon :type="icon" v-if="icon && !loading"></Icon>
<span v-if="showSlot" v-el:slot><slot></slot></span>
<span v-if="showSlot" ref="slot"><slot></slot></span>
</button>
</template>
<script>
@ -63,8 +63,8 @@
];
}
},
compiled () {
this.showSlot = this.$els.slot.innerHTML.replace(/\n/g, '').replace(/<!--[\w\W\r\n]*?-->/gmi, '') !== '';
mounted () {
this.showSlot = this.$refs.slot.innerHTML.replace(/\n/g, '').replace(/<!--[\w\W\r\n]*?-->/gmi, '') !== '';
}
};
</script>

View file

@ -6,7 +6,7 @@ import Affix from './components/affix';
// import BackTop from './components/back-top';
// import Badge from './components/badge';
// import Breadcrumb from './components/breadcrumb';
// import Button from './components/button';
import Button from './components/button';
// import Card from './components/card';
// import Carousel from './components/carousel';
// import Cascader from './components/cascader';
@ -16,7 +16,7 @@ import Affix from './components/affix';
// import DatePicker from './components/date-picker';
// import Dropdown from './components/dropdown';
// import Form from './components/form';
// import Icon from './components/icon';
import Icon from './components/icon';
// import Input from './components/input';
// import InputNumber from './components/input-number';
// import LoadingBar from './components/loading-bar';
@ -54,7 +54,8 @@ const iview = {
// Breadcrumb,
// BreadcrumbItem: Breadcrumb.Item,
// iButton: Button,
// ButtonGroup: Button.Group,
Button,
ButtonGroup: Button.Group,
// Card,
// Carousel,
// CarouselItem: Carousel.Item,
@ -70,7 +71,7 @@ const iview = {
// FormItem: Form.Item,
iCol: Col,
// Collapse,
// Icon,
Icon,
// iInput: Input,
// InputNumber,
// LoadingBar,