I htmlファイルに次の要素を持っている:Aureliaのカスタム要素で "readonly"をバインドする方法は?
<template class="range-slider time-slot">
<div>${duration}</div>
<input type="range" min.bind="min" max.bind="maxStart" step.bind="step" value.bind="value">
</template>
とタイムスロットslider.ts:
<require from="_controls/time-slot-slider"></require>
<time-slot-slider id="zeitraum" min="0" max="24" length="4" value="4"
value.two-way="functionConfig.startTime" if.bind="functionConfig.isAutomatic === true"
readonly.bind="!mayFunctionTestEditTime"></time-slot-slider>
カスタム要素は、(タイムスロットslider.html)はこちら
import { bindable, customElement } from 'aurelia-templating'
import moment from 'moment/moment'
import Moment = moment.Moment
@customElement('time-slot-slider')
export class TimeSlotSlider {
@bindable public min: number = 0.0
@bindable public max: number = 24.0
@bindable public step: number = 0.5
@bindable public value: number = 0.0
@bindable public length: number = 4.0
public get maxStart(): number {
return this.max - this.length
}
public get from(): Moment {
return TimeSlotSlider.numberToMoment(this.value)
}
....
readonly.bindは機能しません。私は読み取り専用でバインドしようとしました
@bindable readOnly: boolean
しかし、私は成功しませんでした。どうすれば修正できますか?
私はそれをしました。しかし、私はこの警告を受け取ります:タイプ 'TimeSlotSlider'で 'readonly'を見つけることができません – Sohrab
あなたは 'readonly'の代わりに' readOnly'を書いています。大文字の「O」に注意してください。 viewmodelで 'readOnly'を' readonly'に、あるいは 'readonly.bind'からそのコンポーネントを使用するHTMLの' read-only.bind'に変更してください。 –
soooooooo多くありがとう – Sohrab