mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
chore: remove Panel component
This commit is contained in:
parent
1e2f55db5a
commit
853417d470
@ -1,55 +0,0 @@
|
|||||||
# Panel
|
|
||||||
|
|
||||||
### Deprecate Tip
|
|
||||||
|
|
||||||
The Panel component will be deprecated in version 3.0. Please use the Cell and Button components instead.
|
|
||||||
|
|
||||||
### Install
|
|
||||||
|
|
||||||
```js
|
|
||||||
import Vue from 'vue';
|
|
||||||
import { Panel } from 'vant';
|
|
||||||
|
|
||||||
Vue.use(Panel);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
|
|
||||||
### Basic Usage
|
|
||||||
|
|
||||||
```html
|
|
||||||
<van-panel title="Title" desc="Description" status="Status">
|
|
||||||
<div>Content</div>
|
|
||||||
</van-panel>
|
|
||||||
```
|
|
||||||
|
|
||||||
### Advanced Usage
|
|
||||||
|
|
||||||
```html
|
|
||||||
<van-panel title="Title" desc="Description" status="Status">
|
|
||||||
<div>Content</div>
|
|
||||||
<template #footer>
|
|
||||||
<van-button size="small">Button</van-button>
|
|
||||||
<van-button size="small" type="danger">Button</van-button>
|
|
||||||
</template>
|
|
||||||
</van-panel>
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### Props
|
|
||||||
|
|
||||||
| Attribute | Description | Type | Default |
|
|
||||||
| --------- | ----------- | -------- | ------- |
|
|
||||||
| icon | Left Icon | _string_ | - |
|
|
||||||
| title | Title | _string_ | - |
|
|
||||||
| desc | Description | _string_ | - |
|
|
||||||
| status | Status | _string_ | - |
|
|
||||||
|
|
||||||
### Slots
|
|
||||||
|
|
||||||
| Name | Description |
|
|
||||||
| ------- | ------------- |
|
|
||||||
| default | Default slot |
|
|
||||||
| header | Custom header |
|
|
||||||
| footer | Custom footer |
|
|
@ -1,59 +0,0 @@
|
|||||||
# Panel 面板
|
|
||||||
|
|
||||||
### 废弃提示
|
|
||||||
|
|
||||||
<b>由于使用场景有限,Panel 组件将在 3.0 版本中废弃</b>,请直接使用 Cell 和 Button 组件代替
|
|
||||||
|
|
||||||
### 引入
|
|
||||||
|
|
||||||
```js
|
|
||||||
import Vue from 'vue';
|
|
||||||
import { Panel } from 'vant';
|
|
||||||
|
|
||||||
Vue.use(Panel);
|
|
||||||
```
|
|
||||||
|
|
||||||
## 代码演示
|
|
||||||
|
|
||||||
### 基础用法
|
|
||||||
|
|
||||||
面板只是一个容器,里面可以放入自定义的内容
|
|
||||||
|
|
||||||
```html
|
|
||||||
<van-panel title="标题" desc="描述信息" status="状态">
|
|
||||||
<div>内容</div>
|
|
||||||
</van-panel>
|
|
||||||
```
|
|
||||||
|
|
||||||
### 高级用法
|
|
||||||
|
|
||||||
使用`slot`自定义内容
|
|
||||||
|
|
||||||
```html
|
|
||||||
<van-panel title="标题" desc="描述信息" status="状态">
|
|
||||||
<div>内容</div>
|
|
||||||
<template #footer>
|
|
||||||
<van-button size="small">按钮</van-button>
|
|
||||||
<van-button size="small" type="danger">按钮</van-button>
|
|
||||||
</template>
|
|
||||||
</van-panel>
|
|
||||||
```
|
|
||||||
|
|
||||||
## API
|
|
||||||
|
|
||||||
### Props
|
|
||||||
|
|
||||||
| 参数 | 说明 | 类型 | 默认值 |
|
|
||||||
| ------ | ------------------------------------------ | -------- | ------ |
|
|
||||||
| title | 标题 | _string_ | - |
|
|
||||||
| desc | 描述 | _string_ | - |
|
|
||||||
| status | 状态 | _string_ | - |
|
|
||||||
| icon | 标题左侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | - |
|
|
||||||
|
|
||||||
### Slots
|
|
||||||
|
|
||||||
| 名称 | 说明 |
|
|
||||||
| ------- | ------------- |
|
|
||||||
| default | 自定义内容 |
|
|
||||||
| header | 自定义 header |
|
|
||||||
| footer | 自定义 footer |
|
|
@ -1,41 +0,0 @@
|
|||||||
<template>
|
|
||||||
<demo-section>
|
|
||||||
<demo-block :title="t('basicUsage')">
|
|
||||||
<van-panel :title="t('title')" :desc="t('desc')" :status="t('status')">
|
|
||||||
<div>{{ t('content') }}</div>
|
|
||||||
</van-panel>
|
|
||||||
</demo-block>
|
|
||||||
|
|
||||||
<demo-block :title="t('advancedUsage')">
|
|
||||||
<van-panel :title="t('title')" :desc="t('desc')" :status="t('status')">
|
|
||||||
<div>{{ t('content') }}</div>
|
|
||||||
<template #footer>
|
|
||||||
<van-button size="small">{{ t('button') }}</van-button>
|
|
||||||
<van-button size="small" type="danger">
|
|
||||||
{{ t('button') }}
|
|
||||||
</van-button>
|
|
||||||
</template>
|
|
||||||
</van-panel>
|
|
||||||
</demo-block>
|
|
||||||
</demo-section>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {};
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="less">
|
|
||||||
.demo-panel {
|
|
||||||
.van-panel__footer {
|
|
||||||
text-align: right;
|
|
||||||
|
|
||||||
.van-button {
|
|
||||||
margin-left: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.van-panel__content {
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
@ -1,13 +0,0 @@
|
|||||||
@import '../style/var';
|
|
||||||
|
|
||||||
.van-panel {
|
|
||||||
background: @panel-background-color;
|
|
||||||
|
|
||||||
&__header-value {
|
|
||||||
color: @panel-header-value-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__footer {
|
|
||||||
padding: @panel-footer-padding;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,69 +0,0 @@
|
|||||||
// Utils
|
|
||||||
import { createNamespace } from '../utils';
|
|
||||||
import { inherit } from '../utils/functional';
|
|
||||||
import { BORDER_TOP } from '../utils/constant';
|
|
||||||
|
|
||||||
// Components
|
|
||||||
import Cell from '../cell';
|
|
||||||
import CellGroup from '../cell-group';
|
|
||||||
|
|
||||||
// Types
|
|
||||||
import { CreateElement, RenderContext } from 'vue/types';
|
|
||||||
import { ScopedSlot, DefaultSlots } from '../utils/types';
|
|
||||||
|
|
||||||
export type PanelProps = {
|
|
||||||
icon?: string;
|
|
||||||
desc?: string;
|
|
||||||
title?: string;
|
|
||||||
status?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export type PanelSlots = DefaultSlots & {
|
|
||||||
header?: ScopedSlot;
|
|
||||||
footer?: ScopedSlot;
|
|
||||||
};
|
|
||||||
|
|
||||||
const [createComponent, bem] = createNamespace('panel');
|
|
||||||
|
|
||||||
function Panel(
|
|
||||||
h: CreateElement,
|
|
||||||
props: PanelProps,
|
|
||||||
slots: PanelSlots,
|
|
||||||
ctx: RenderContext<PanelProps>
|
|
||||||
) {
|
|
||||||
const Content = () => [
|
|
||||||
slots.header ? (
|
|
||||||
slots.header()
|
|
||||||
) : (
|
|
||||||
<Cell
|
|
||||||
icon={props.icon}
|
|
||||||
label={props.desc}
|
|
||||||
title={props.title}
|
|
||||||
value={props.status}
|
|
||||||
class={bem('header')}
|
|
||||||
valueClass={bem('header-value')}
|
|
||||||
/>
|
|
||||||
),
|
|
||||||
<div class={bem('content')}>{slots.default && slots.default()}</div>,
|
|
||||||
slots.footer && (
|
|
||||||
<div class={[bem('footer'), BORDER_TOP]}>{slots.footer()}</div>
|
|
||||||
),
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<CellGroup
|
|
||||||
class={bem()}
|
|
||||||
scopedSlots={{ default: Content }}
|
|
||||||
{...inherit(ctx, true)}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
Panel.props = {
|
|
||||||
icon: String,
|
|
||||||
desc: String,
|
|
||||||
title: String,
|
|
||||||
status: String,
|
|
||||||
};
|
|
||||||
|
|
||||||
export default createComponent<PanelProps>(Panel);
|
|
@ -1,39 +0,0 @@
|
|||||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
||||||
|
|
||||||
exports[`renders demo correctly 1`] = `
|
|
||||||
<div>
|
|
||||||
<div>
|
|
||||||
<div class="van-cell-group van-hairline--top-bottom van-panel">
|
|
||||||
<div class="van-cell van-panel__header">
|
|
||||||
<div class="van-cell__title"><span>标题</span>
|
|
||||||
<div class="van-cell__label">描述信息</div>
|
|
||||||
</div>
|
|
||||||
<div class="van-cell__value van-panel__header-value"><span>状态</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="van-panel__content">
|
|
||||||
<div>内容</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<div class="van-cell-group van-hairline--top-bottom van-panel">
|
|
||||||
<div class="van-cell van-panel__header">
|
|
||||||
<div class="van-cell__title"><span>标题</span>
|
|
||||||
<div class="van-cell__label">描述信息</div>
|
|
||||||
</div>
|
|
||||||
<div class="van-cell__value van-panel__header-value"><span>状态</span></div>
|
|
||||||
</div>
|
|
||||||
<div class="van-panel__content">
|
|
||||||
<div>内容</div>
|
|
||||||
</div>
|
|
||||||
<div class="van-panel__footer van-hairline--top"><button class="van-button van-button--default van-button--small">
|
|
||||||
<div class="van-button__content"><span class="van-button__text">按钮</span></div>
|
|
||||||
</button> <button class="van-button van-button--danger van-button--small">
|
|
||||||
<div class="van-button__content"><span class="van-button__text">
|
|
||||||
按钮
|
|
||||||
</span></div>
|
|
||||||
</button></div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
`;
|
|
@ -1,4 +0,0 @@
|
|||||||
import Demo from '../demo';
|
|
||||||
import { snapshotDemo } from '../../../test/demo';
|
|
||||||
|
|
||||||
snapshotDemo(Demo);
|
|
@ -355,10 +355,6 @@ module.exports = {
|
|||||||
path: 'submit-bar',
|
path: 'submit-bar',
|
||||||
title: 'SubmitBar 提交订单栏',
|
title: 'SubmitBar 提交订单栏',
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// path: 'sku',
|
|
||||||
// title: 'Sku 商品规格',
|
|
||||||
// },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -689,10 +685,6 @@ module.exports = {
|
|||||||
path: 'submit-bar',
|
path: 'submit-bar',
|
||||||
title: 'SubmitBar',
|
title: 'SubmitBar',
|
||||||
},
|
},
|
||||||
// {
|
|
||||||
// path: 'sku',
|
|
||||||
// title: 'Sku',
|
|
||||||
// },
|
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user