pull/6537/head
tugcekucukoglu 2024-10-02 14:07:40 +03:00
parent 68700f5ae6
commit 813bbc9307
3 changed files with 9 additions and 23 deletions

View File

@ -65,10 +65,6 @@ export interface ToggleSwitchPassThroughOptions {
* Used to pass attributes to the handle's DOM element.
*/
handle?: ToggleSwitchPassThroughOptionType;
/**
* Used to pass attributes to the icon's DOM element.
*/
icon?: ToggleSwitchPassThroughOptionType;
/**
* Used to manage all lifecycle hooks.
* @see {@link BaseComponent.ComponentHooks}
@ -180,10 +176,10 @@ export interface ToggleSwitchContext {
export interface ToggleSwitchSlots {
/**
* Custom icon template.
* @param {Object} scope - icon slot's params.
* Custom handle template.
* @param {Object} scope - handle slot's params.
*/
icon(scope: {
handle(scope: {
/**
* Current checked state of the item as a boolean.
*/

View File

@ -19,21 +19,16 @@
@change="onChange"
v-bind="getPTOptions('input')"
/>
<span :class="cx('slider')" v-bind="getPTOptions('slider')">
<span :class="cx('handle')" v-bind="getPTOptions('handle')">
<slot name="icon" :checked="checked">
<CheckIcon v-if="checked" :class="cx('icon')" v-bind="getPTOptions('icon')" />
<TimesIcon v-else :class="cx('icon')" v-bind="getPTOptions('icon')" />
</slot>
</span>
</span>
<div :class="cx('slider')" v-bind="getPTOptions('slider')">
<div :class="cx('handle')" v-bind="getPTOptions('handle')">
<slot name="handle" :checked="checked" />
</div>
</div>
</div>
</template>
<script>
import BaseToggleSwitch from './BaseToggleSwitch.vue';
import TimesIcon from '@primevue/icons/times';
import CheckIcon from '@primevue/icons/check';
export default {
name: 'ToggleSwitch',
@ -70,10 +65,6 @@ export default {
checked() {
return this.modelValue === this.trueValue;
}
},
components: {
CheckIcon,
TimesIcon
}
};
</script>

View File

@ -121,8 +121,7 @@ const classes = {
],
input: 'p-toggleswitch-input',
slider: 'p-toggleswitch-slider',
handle: 'p-toggleswitch-handle',
icon: 'p-toggleswitch-icon'
handle: 'p-toggleswitch-handle'
};
export default BaseStyle.extend({