2016-07-13 05:00:31 +00:00
|
|
|
<style lang="scss" src="./mdButton.scss"></style>
|
2016-06-21 06:54:17 +00:00
|
|
|
|
2016-07-15 00:06:29 +00:00
|
|
|
<script>
|
|
|
|
|
export default {
|
2016-09-08 05:15:03 +00:00
|
|
|
props: {
|
|
|
|
|
href: String,
|
|
|
|
|
type: String,
|
|
|
|
|
disabled: Boolean
|
|
|
|
|
},
|
2016-09-05 05:15:28 +00:00
|
|
|
render(createElement) {
|
|
|
|
|
let isDisabled = Boolean(this.disabled);
|
|
|
|
|
let hasLink = Boolean(this.href);
|
|
|
|
|
let tag = 'button';
|
|
|
|
|
let emitClick = () => {
|
|
|
|
|
this.$emit('click');
|
|
|
|
|
};
|
|
|
|
|
let options = {
|
|
|
|
|
staticClass: 'md-button',
|
|
|
|
|
attrs: {
|
|
|
|
|
type: hasLink || 'button',
|
|
|
|
|
disabled: isDisabled
|
|
|
|
|
},
|
|
|
|
|
directives: [{
|
|
|
|
|
name: 'md-ink-ripple',
|
|
|
|
|
value: isDisabled,
|
|
|
|
|
expression: 'disabled'
|
|
|
|
|
}],
|
|
|
|
|
on: {
|
|
|
|
|
click: emitClick
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
if (hasLink) {
|
|
|
|
|
tag = 'a';
|
|
|
|
|
options.attrs.href = this.href;
|
|
|
|
|
delete options.attrs.type;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return createElement(tag, options, this.$slots.default);
|
2016-07-15 00:06:29 +00:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
</script>
|