push
This commit is contained in:
4
lib/component/form/switch/index.ts
Normal file
4
lib/component/form/switch/index.ts
Normal file
@@ -0,0 +1,4 @@
|
||||
import nsSwitch from './switch.vue';
|
||||
import { withInstall } from '/nerv-lib/util';
|
||||
|
||||
export const NsSwitch = withInstall(nsSwitch);
|
||||
43
lib/component/form/switch/switch.vue
Normal file
43
lib/component/form/switch/switch.vue
Normal file
@@ -0,0 +1,43 @@
|
||||
<template>
|
||||
<a-switch v-bind="$attrs">
|
||||
<template #checkedChildren>
|
||||
{{ checkType ? '' : checkInfo.checked }}
|
||||
<ns-icon v-if="checkType" :name="checkInfo.checked" :size="iconSize"
|
||||
/></template>
|
||||
<template #unCheckedChildren
|
||||
>{{ checkType ? '' : checkInfo.unChecked
|
||||
}}<ns-icon v-if="checkType" :name="checkInfo.unChecked" :size="iconSize"
|
||||
/></template>
|
||||
</a-switch>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { defineComponent } from 'vue';
|
||||
|
||||
export default defineComponent({
|
||||
name: 'NsSwitch',
|
||||
props: {
|
||||
checkInfo: {
|
||||
type: Object,
|
||||
default: () => ({
|
||||
checked: '',
|
||||
unChecked: '',
|
||||
}),
|
||||
},
|
||||
checkType: {
|
||||
type: String,
|
||||
},
|
||||
iconSize: {
|
||||
type: Number,
|
||||
default: 10,
|
||||
},
|
||||
},
|
||||
setup(props) {
|
||||
// eslint-disable-next-line vue/no-setup-props-destructure
|
||||
const { checkInfo, checkType, iconSize } = props;
|
||||
// eslint-disable-next-line vue/no-dupe-keys
|
||||
return { checkInfo, checkType, iconSize };
|
||||
},
|
||||
});
|
||||
</script>
|
||||
<style lang="less" scoped></style>
|
||||
Reference in New Issue
Block a user