Commit da2c7be0 authored by Sendya's avatar Sendya

fix: contentWidth prop type

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