pull/5630/head
tugcekucukoglu 2024-04-19 12:16:26 +03:00
parent e747e01e3d
commit e7ec2ad79a
4 changed files with 7 additions and 11 deletions

View File

@ -74,8 +74,8 @@ const KnobProps = [
{ {
name: 'valueTemplate', name: 'valueTemplate',
type: 'function | string', type: 'function | string',
default: 'val => val', default: '{value}',
description: 'Controls how the knob is labeled.' description: 'Template of the value.'
}, },
{ {
name: 'tabindex', name: 'tabindex',

View File

@ -56,7 +56,7 @@ export default {
}, },
valueTemplate: { valueTemplate: {
type: [String, Function], type: [String, Function],
default: () => (val) => val default: '{value}'
}, },
tabindex: { tabindex: {
type: Number, type: Number,

View File

@ -176,7 +176,7 @@ export interface KnobProps {
showValue?: boolean | undefined; showValue?: boolean | undefined;
/** /**
* Template string of the value. * Template string of the value.
* @defaultValue 'val => val' * @defaultValue '{value}'
*/ */
valueTemplate?: (val: number) => string | string | undefined; valueTemplate?: (val: number) => string | string | undefined;
/** /**

View File

@ -2,9 +2,8 @@
<DocSectionText v-bind="$attrs"> <DocSectionText v-bind="$attrs">
<p>The label can be customized with the <i>valueTemplate</i> property using either a template string or a function.</p> <p>The label can be customized with the <i>valueTemplate</i> property using either a template string or a function.</p>
</DocSectionText> </DocSectionText>
<div class="card flex justify-content-center gap-4"> <div class="card flex justify-content-center">
<Knob v-model="value" valueTemplate="{value}%" /> <Knob v-model="value" valueTemplate="{value}%" />
<Knob v-model="value" :valueTemplate="(val) => val / 100" />
</div> </div>
<DocSectionCode :code="code" /> <DocSectionCode :code="code" />
</template> </template>
@ -17,13 +16,11 @@ export default {
code: { code: {
basic: ` basic: `
<Knob v-model="value" valueTemplate="{value}%" /> <Knob v-model="value" valueTemplate="{value}%" />
<Knob v-model="value" :valueTemplate="val => val / 100" />
`, `,
options: ` options: `
<template> <template>
<div class="card flex justify-content-center gap-4"> <div class="card flex justify-content-center">
<Knob v-model="value" valueTemplate="{value}%" /> <Knob v-model="value" valueTemplate="{value}%" />
<Knob v-model="value" :valueTemplate="val => val / 100" />
</div> </div>
</template> </template>
@ -39,9 +36,8 @@ export default {
`, `,
composition: ` composition: `
<template> <template>
<div class="card flex justify-content-center gap-4"> <div class="card flex justify-content-center">
<Knob v-model="value" valueTemplate="{value}%" /> <Knob v-model="value" valueTemplate="{value}%" />
<Knob v-model="value" :valueTemplate="val => val / 100" />
</div> </div>
</template> </template>