Line | |
---|
1 | <template>
|
---|
2 | <div class="root">
|
---|
3 | <input type="range" class="slider-continuous" v-model="sliderValue" :max="audioLength" step="0.01" />
|
---|
4 | <span>{{ sliderValue }}</span>
|
---|
5 | </div>
|
---|
6 | </template>
|
---|
7 |
|
---|
8 | <style lang="scss" scoped>
|
---|
9 | .root {
|
---|
10 | display: flex;
|
---|
11 | align-items: center;
|
---|
12 | gap: 1em;
|
---|
13 | }
|
---|
14 | </style>
|
---|
15 |
|
---|
16 | <script>
|
---|
17 | import Util from "../js/Util"
|
---|
18 |
|
---|
19 | export default {
|
---|
20 | name: "AudioTimeBar",
|
---|
21 | props: {
|
---|
22 | modelValue: Number,
|
---|
23 | audioLength: Number
|
---|
24 | },
|
---|
25 | emits: [ "update:modelValue" ],
|
---|
26 | data() {
|
---|
27 | return {
|
---|
28 | myValue: 0
|
---|
29 | }
|
---|
30 | },
|
---|
31 | computed: {
|
---|
32 | sliderValue: {
|
---|
33 | get() {
|
---|
34 | if (this.myValue < 0) {
|
---|
35 | return 0;
|
---|
36 | }
|
---|
37 |
|
---|
38 | if (this.myValue > this.audioLength) {
|
---|
39 | return this.audioLength;
|
---|
40 | }
|
---|
41 |
|
---|
42 | return this.myValue;
|
---|
43 | },
|
---|
44 | set(newValue) {
|
---|
45 | this.$emit("update:modelValue", newValue);
|
---|
46 | this.myValue = newValue;
|
---|
47 | }
|
---|
48 | },
|
---|
49 | stringSliderValue() {
|
---|
50 | return Util.formatSecondsTimeString(this.sliderValue);
|
---|
51 | }
|
---|
52 | }
|
---|
53 | }
|
---|
54 | </script>
|
---|
Note:
See
TracBrowser
for help on using the repository browser.