-
Notifications
You must be signed in to change notification settings - Fork 834
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(layout): move to script setup (#2951)
- Loading branch information
Showing
22 changed files
with
275 additions
and
207 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template> | ||
<view :class="classes" :style="style"> | ||
<slot></slot> | ||
</view> | ||
</template> | ||
<script setup lang="ts"> | ||
import { computed, inject } from 'vue'; | ||
import { LAYOUT_KEY } from '../layout/types'; | ||
defineOptions({ | ||
name: 'NutCol' | ||
}); | ||
export type ColProps = Partial<{ | ||
span: string | number; | ||
offset: string | number; | ||
}>; | ||
const props = withDefaults(defineProps<ColProps>(), { | ||
span: 24, | ||
offset: 0 | ||
}); | ||
const prefixCls = 'nut-col'; | ||
const gutter = inject(LAYOUT_KEY) as number; | ||
const classes = computed(() => { | ||
return { | ||
[prefixCls]: true, | ||
[prefixCls + '-gutter']: gutter, | ||
['nut-col-' + props.span]: true, | ||
['nut-col-offset-' + props.offset]: true | ||
}; | ||
}); | ||
const style = computed(() => { | ||
return { | ||
paddingLeft: gutter / 2 + 'px', | ||
paddingRight: gutter / 2 + 'px' | ||
}; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<template> | ||
<view :class="classes" :style="style"> | ||
<slot></slot> | ||
</view> | ||
</template> | ||
<script setup lang="ts"> | ||
import { computed, inject } from 'vue'; | ||
import { LAYOUT_KEY } from '../layout/types'; | ||
defineOptions({ | ||
name: 'NutCol' | ||
}); | ||
export type ColProps = Partial<{ | ||
span: string | number; | ||
offset: string | number; | ||
}>; | ||
const props = withDefaults(defineProps<ColProps>(), { | ||
span: 24, | ||
offset: 0 | ||
}); | ||
const prefixCls = 'nut-col'; | ||
const gutter = inject(LAYOUT_KEY) as number; | ||
const classes = computed(() => { | ||
return { | ||
[prefixCls]: true, | ||
[prefixCls + '-gutter']: gutter, | ||
['nut-col-' + props.span]: true, | ||
['nut-col-offset-' + props.offset]: true | ||
}; | ||
}); | ||
const style = computed(() => { | ||
return { | ||
paddingLeft: gutter / 2 + 'px', | ||
paddingRight: gutter / 2 + 'px' | ||
}; | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Col from './col.taro.vue'; | ||
import type { ComponentPublicInstance } from 'vue'; | ||
import { withInstall } from '@/packages/utils'; | ||
|
||
withInstall(Col); | ||
|
||
export type { ColProps } from './col.taro.vue'; | ||
|
||
export type ColInstance = ComponentPublicInstance & InstanceType<typeof Col>; | ||
|
||
export { Col, Col as default }; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Col from './col.vue'; | ||
import type { ComponentPublicInstance } from 'vue'; | ||
import { withInstall } from '@/packages/utils'; | ||
|
||
withInstall(Col); | ||
|
||
export type { ColProps } from './col.vue'; | ||
|
||
export type ColInstance = ComponentPublicInstance & InstanceType<typeof Col>; | ||
|
||
export { Col, Col as default }; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Layout from './layout.taro.vue'; | ||
import type { ComponentPublicInstance } from 'vue'; | ||
import { withInstall } from '@/packages/utils'; | ||
|
||
withInstall(Layout); | ||
|
||
export type LayoutInstance = ComponentPublicInstance & InstanceType<typeof Layout>; | ||
|
||
export { Layout, Layout as default }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Layout from './layout.vue'; | ||
import type { ComponentPublicInstance } from 'vue'; | ||
import { withInstall } from '@/packages/utils'; | ||
|
||
withInstall(Layout); | ||
|
||
export type LayoutInstance = ComponentPublicInstance & InstanceType<typeof Layout>; | ||
|
||
export { Layout, Layout as default }; |
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Row from './row.taro.vue'; | ||
import type { ComponentPublicInstance } from 'vue'; | ||
import { withInstall } from '@/packages/utils'; | ||
|
||
withInstall(Row); | ||
|
||
export type { RowProps } from './row.taro.vue'; | ||
|
||
export type RowInstance = ComponentPublicInstance & InstanceType<typeof Row>; | ||
|
||
export { Row, Row as default }; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Row from './row.vue'; | ||
import type { ComponentPublicInstance } from 'vue'; | ||
import { withInstall } from '@/packages/utils'; | ||
|
||
withInstall(Row); | ||
|
||
export type { RowProps } from './row.vue'; | ||
|
||
export type RowInstance = ComponentPublicInstance & InstanceType<typeof Row>; | ||
|
||
export { Row, Row as default }; |
Oops, something went wrong.