1先写button组件页面
<template>
<!-- 1将需要的button属性全部搬运过来,css有需要自己写,定好大小宽高行间距 -->
<el-button
:type="primary"
:disabled="disabled"
:icon="icon"
style="width: 98px"
>
<slot>{
{ buttonVal }}</slot>
</el-button>
</template>
<script>
export default {
name: "my-button",
props: {
//2将从父组件传值
// data: {
// default() {
// return [];
// },
// type: Array,
// },
primary: {
default: "primary",
type: String,
},
disabled: {
default: false,
type: Boolean,
},
buttonVal: {
default: "点击",
type: String,
},
icon: {
default: "",
type: String,
},
},
data() {
return {};
},
mounted() {},
methods: {},
};
</script>
<style lang="scss" scoped></style>