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',
type: 'function | string',
default: 'val => val',
description: 'Controls how the knob is labeled.'
default: '{value}',
description: 'Template of the value.'
},
{
name: 'tabindex',

View File

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

View File

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

View File

@ -2,9 +2,8 @@
<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>
</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="(val) => val / 100" />
</div>
<DocSectionCode :code="code" />
</template>
@ -17,13 +16,11 @@ export default {
code: {
basic: `
<Knob v-model="value" valueTemplate="{value}%" />
<Knob v-model="value" :valueTemplate="val => val / 100" />
`,
options: `
<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="val => val / 100" />
</div>
</template>
@ -39,9 +36,8 @@ export default {
`,
composition: `
<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="val => val / 100" />
</div>
</template>