init
This commit is contained in:
1
uni_modules/nutui-uni/components/swipegroup/index.ts
Normal file
1
uni_modules/nutui-uni/components/swipegroup/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from './swipegroup'
|
||||
12
uni_modules/nutui-uni/components/swipegroup/swipegroup.ts
Normal file
12
uni_modules/nutui-uni/components/swipegroup/swipegroup.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import type { ExtractPropTypes } from 'vue'
|
||||
import { commonProps } from '../_utils'
|
||||
|
||||
export const swipegroupProps = {
|
||||
...commonProps,
|
||||
/**
|
||||
* @description 控制内部 Swipe 互斥,即滑动打开某一个 Swipe 时,触发其余 Swipe 的 close 方法
|
||||
*/
|
||||
lock: Boolean,
|
||||
}
|
||||
|
||||
export type SwipeGroupProps = ExtractPropTypes<typeof swipegroupProps>
|
||||
47
uni_modules/nutui-uni/components/swipegroup/swipegroup.vue
Normal file
47
uni_modules/nutui-uni/components/swipegroup/swipegroup.vue
Normal file
@@ -0,0 +1,47 @@
|
||||
<script lang="ts" setup>
|
||||
import { computed, defineComponent, provide, ref, toRef } from 'vue'
|
||||
import { PREFIX } from '../_constants'
|
||||
import { getMainClass } from '../_utils'
|
||||
import { swipegroupProps } from './swipegroup'
|
||||
|
||||
const props = defineProps(swipegroupProps)
|
||||
|
||||
const classes = computed(() => {
|
||||
return getMainClass(props, componentName)
|
||||
})
|
||||
|
||||
const name = ref('')
|
||||
|
||||
function update(value: string) {
|
||||
name.value = value
|
||||
}
|
||||
|
||||
provide('swipeGroup', {
|
||||
update,
|
||||
lock: toRef(props, 'lock'),
|
||||
name,
|
||||
})
|
||||
</script>
|
||||
|
||||
<script lang="ts">
|
||||
const componentName = `${PREFIX}-swipe-group`
|
||||
|
||||
export default defineComponent({
|
||||
name: componentName,
|
||||
options: {
|
||||
virtualHost: true,
|
||||
addGlobalClass: true,
|
||||
styleIsolation: 'shared',
|
||||
},
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<view :class="classes" :style="props.customStyle">
|
||||
<slot />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<style lang="scss">
|
||||
@import "./index";
|
||||
</style>
|
||||
Reference in New Issue
Block a user