I am using date, the user selects the date, and then the selected date is displayed in the browser, the problem is that I want to change the color for the last two items except that remove the last comma
I used splice
to remove the first word, but I could not remove the last comma, that is, at the moment in May, the date looks like this
Please note that I do not need to change the date, I only need to change the color of the last two words and remove the comma
Also you can look at the whole code at codesandbox
I want to get the following result
<date-pick
v-model="date"
:format="format"
:parseDate="parseDate"
:formatDate="formatDate">
<template v-slot:default="{toggle, inputValue}">
<div class="mount-container">
<h1><span ref="mount" class="mount-title">
{{ inputValue.split(' ').splice(0,3).join(' ') }}
</span></h1>
</div>
</template>
</date-pick>
I don't know how much you need it, but I want to leave a link to the npm package the date I use if you need more code or information, write I will definitely provide
Edited
I wanted to use this approach, but it didn't help
mounted() {
let mount = this.$refs.mount.split(' ').pop();
mount.style.color = 'yellow'
},
But the interesting thing is that if I apply the color without split
then it works.
mounted() {
let mount = this.$refs.mount;
mount.style.color = 'yellow'
},