Commit da2c7be0 authored by Sendya's avatar Sendya

fix: contentWidth prop type

parent 17536896
......@@ -56,7 +56,7 @@ export default {
// 布局类型
layout: 'sidemenu', // 'sidemenu', 'topmenu'
// 定宽: true / 流式: false
contentWidth: false,
contentWidth: 'Fluid', // layout of content: `Fluid` or `Fixed`, only works when layout is topmenu
// 主题 'dark' | 'light'
theme: 'dark',
// 是否手机模式
......
......@@ -11,7 +11,7 @@ const WrapContentProps = {
isChildrenLayout: PropTypes.bool,
location: PropTypes.any,
contentHeight: PropTypes.number,
contentWidth: PropTypes.bool
contentWidth: PropTypes.oneOf(['Fluid', 'Fixed']).def('Fluid'),
}
const WrapContent = {
......
......@@ -2,7 +2,7 @@ import PropTypes from 'ant-design-vue/es/_util/vue-types'
const ProConfigProviderProps = {
i18nRender: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]).def(false),
contentWidth: PropTypes.bool,
contentWidth: PropTypes.oneOf(['Fluid', 'Fixed']).def('Fluid'),
breadcrumbRender: PropTypes.func,
}
......
......@@ -60,7 +60,7 @@ const GlobalHeader = {
)}
{renderCollapsedButton()}
{headerContentRender && (
<div className={`${headerCls}-content`}>
<div class={`${headerCls}-content`}>
{isFun(headerContentRender) && headerContentRender(h, this.$props) || headerContentRender}
</div>
)}
......
import './index.less'
import PropTypes from 'ant-design-vue/es/_util/vue-types'
import { layoutContentWidth } from '../../utils/util'
const GridContent = {
name: 'GridContent',
functional: true,
props: {
children: PropTypes.any,
contentWidth: PropTypes.bool,
contentWidth: PropTypes.oneOf(['Fluid', 'Fixed']).def('Fluid'),
},
render (h, content) {
const { contentWidth: propsContentWidth } = content.props
const { contentWidth } = content.props
const children = content.children
const propsContentWidth = layoutContentWidth(contentWidth)
const classNames = {
['ant-pro-grid-content']: true,
['wide']: propsContentWidth
......
......@@ -48,7 +48,7 @@ export default {
title: i18n('app.setting.content-width'),
action: (
<Select
value={contentWidth && 'Fixed' || 'Fluid'}
value={contentWidth}
size="small"
onSelect={(value) => handleChange('contentWidth', value)}
style={{ width: '80px' }}
......
......@@ -152,7 +152,7 @@ export const settings = {
primaryColor: PropTypes.string,
layout: PropTypes.oneOf(['sidemenu', 'topmenu']),
colorWeak: PropTypes.bool,
contentWidth: PropTypes.bool,
contentWidth: PropTypes.oneOf(['Fluid', 'Fixed']).def('Fluid'),
fixedHeader: PropTypes.bool,
fixSiderbar: PropTypes.bool,
hideHintAlert: PropTypes.bool.def(false),
......@@ -188,7 +188,7 @@ const SettingDrawer = {
layout = 'sidemenu',
fixedHeader = false,
fixSiderbar = false,
contentWidth = false,
contentWidth,
hideHintAlert,
hideCopyButton,
colorWeak
......
......@@ -12,7 +12,7 @@ export const SiderMenuProps = {
i18nRender: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]).def(false),
mode: PropTypes.string.def('inline'),
theme: PropTypes.string.def('dark'),
contentWidth: PropTypes.bool,
contentWidth: PropTypes.oneOf(['Fluid', 'Fixed']).def('Fluid'),
collapsible: PropTypes.bool,
collapsed: PropTypes.bool,
handleCollapse: PropTypes.func,
......
......@@ -10,6 +10,10 @@ const isFun = (func) => {
return typeof func === 'function'
}
export const layoutContentWidth = (contentType) => {
return contentType !== 'Fluid'
}
const themeConfig = {
daybreak: 'daybreak',
'#1890ff': 'daybreak',
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment