Commit 8f5016e3f3476539a763162ea235cf2aac230eea

Authored by vben
1 parent 6bffdb5c

feat: the Button component extends the and attributes

CHANGELOG.zh_CN.md
@@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
3 ### ✨ Features 3 ### ✨ Features
4 4
5 - 新增`pwa`功能,可在`.env.production`开启 5 - 新增`pwa`功能,可在`.env.production`开启
  6 +- Button 组件扩展 `preIcon`和`postIcon`属性用于在文本前后添加图标
6 7
7 ### 🎫 Chores 8 ### 🎫 Chores
8 9
@@ -25,6 +26,7 @@ @@ -25,6 +26,7 @@
25 26
26 - 修复热更新时多次注册组件警告问题 27 - 修复热更新时多次注册组件警告问题
27 - 修复登录后出现登录标签页 28 - 修复登录后出现登录标签页
  29 +- 修复路由切换参数消失问题
28 30
29 ## 2.0.0-rc.5 (2020-10-26) 31 ## 2.0.0-rc.5 (2020-10-26)
30 32
src/components/Button/index.vue
1 <template> 1 <template>
2 <Button v-bind="getBindValue" :class="[getColor, $attrs.class]"> 2 <Button v-bind="getBindValue" :class="[getColor, $attrs.class]">
3 - <template #[item]="data" v-for="item in Object.keys($slots)"> 3 + <!-- <template #[item]="data" v-for="item in Object.keys($slots)">
4 <slot :name="item" v-bind="data" /> 4 <slot :name="item" v-bind="data" />
  5 + </template> -->
  6 + <template #default="data">
  7 + <g-icon :icon="preIcon" class="mr-1" v-if="preIcon" />
  8 + <slot v-bind="data" />
  9 + <g-icon :icon="preIcon" class="ml-1" v-if="postIcon" />
5 </template> 10 </template>
6 </Button> 11 </Button>
7 </template> 12 </template>
@@ -44,6 +49,12 @@ @@ -44,6 +49,12 @@
44 type: Boolean as PropType<boolean>, 49 type: Boolean as PropType<boolean>,
45 default: false, 50 default: false,
46 }, 51 },
  52 + preIcon: {
  53 + type: String as PropType<string>,
  54 + },
  55 + postIcon: {
  56 + type: String as PropType<string>,
  57 + },
47 }, 58 },
48 setup(props, { attrs }) { 59 setup(props, { attrs }) {
49 const getListeners = computed(() => { 60 const getListeners = computed(() => {
src/views/demo/feat/msg/index.vue
1 <template> 1 <template>
2 <div class="p-4"> 2 <div class="p-4">
3 <CollapseContainer class="px-20 bg-white w-full h-32 rounded-md" title="Message"> 3 <CollapseContainer class="px-20 bg-white w-full h-32 rounded-md" title="Message">
4 - <a-button @click="infoMsg('Info message')" class="mr-2">Info</a-button> 4 + <a-button @click="infoMsg('Info message')" class="mr-2"> Info </a-button>
5 <a-button @click="successMsg('Success message')" class="mr-2" color="success"> 5 <a-button @click="successMsg('Success message')" class="mr-2" color="success">
6 Success 6 Success
7 </a-button> 7 </a-button>