feat: const/flex

This commit is contained in:
FairyEver 2021-11-08 16:24:07 +08:00
parent 02325a54c0
commit 4e9e5a0c96
7 changed files with 11 additions and 8 deletions

View File

@ -20,11 +20,11 @@ import { computed, ref } from 'vue'
import { cssUnit } from 'd2/utils/css.js'
import { useCssPosition } from 'd2/use/css-position.js'
const classname = makeClassNameByUrl(import.meta.url)
export default {
name: makeNameByUrl(import.meta.url),
setup () {
const classname = makeClassNameByUrl(import.meta.url)
const headerHeight = ref(46)
const asideWidth = ref(200)

View File

@ -3,7 +3,7 @@ import { defineComponent, unref, computed } from 'vue'
import { pickBy, isUndefined } from 'lodash-es'
import { isNumberLike } from 'd2/utils/number.js'
import { makeName, makeClassName } from 'd2/utils/component.js'
import { isFlexProp } from 'd2/utils/const.js'
import { isFlexProp } from 'd2/utils/const/flex.js'
const name = 'flex'

View File

@ -17,5 +17,8 @@ export const flexProps = {
* @returns boolean
*/
export function isFlexProp (type, value, empty) {
return empty && isEmptyString(value) || flexProps[type] && flexProps[type].includes(value)
if (empty && isEmptyString(value)) {
return false
}
return !!flexProps[type]?.includes(value)
}

View File

@ -25,7 +25,7 @@
</template>
<script>
import { flexProps } from 'd2/utils/const.js'
import { flexProps } from 'd2/utils/const/flex.js'
const { dir, main, cross, box } = flexProps

View File

@ -9,7 +9,7 @@
</template>
<script>
import { flexProps } from 'd2/utils/const.js'
import { flexProps } from 'd2/utils/const/flex.js'
const { content } = flexProps

View File

@ -48,7 +48,7 @@
<script>
import { ref } from 'vue'
import { flexProps } from 'd2/utils/const.js'
import { flexProps } from 'd2/utils/const/flex.js'
const { dir, main, cross, box } = flexProps

View File

@ -11,7 +11,7 @@
</template>
<script>
import { flexProps } from 'd2/utils/const.js'
import { flexProps } from 'd2/utils/const/flex.js'
const { self } = flexProps