forked from platypush/platypush
Added mixins to capitalize/prettify text
This commit is contained in:
parent
655d56f4da
commit
b2ff66aa62
2 changed files with 19 additions and 1 deletions
|
@ -5,10 +5,11 @@ import DateTime from "@/utils/DateTime";
|
||||||
import Events from "@/utils/Events";
|
import Events from "@/utils/Events";
|
||||||
import Notification from "@/utils/Notification";
|
import Notification from "@/utils/Notification";
|
||||||
import Screen from "@/utils/Screen";
|
import Screen from "@/utils/Screen";
|
||||||
|
import Text from "@/utils/Text";
|
||||||
import Types from "@/utils/Types";
|
import Types from "@/utils/Types";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Utils",
|
name: "Utils",
|
||||||
mixins: [Api, Cookies, Notification, Events, DateTime, Screen, Types],
|
mixins: [Api, Cookies, Notification, Events, DateTime, Screen, Text, Types],
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
17
platypush/backend/http/webapp/src/utils/Text.vue
Normal file
17
platypush/backend/http/webapp/src/utils/Text.vue
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "Text",
|
||||||
|
methods: {
|
||||||
|
capitalize(text) {
|
||||||
|
if (!text?.length)
|
||||||
|
return text
|
||||||
|
|
||||||
|
return text.charAt(0).toUpperCase() + text.slice(1)
|
||||||
|
},
|
||||||
|
|
||||||
|
prettify(text) {
|
||||||
|
return text.split('_').map((t) => this.capitalize(t)).join(' ')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
Loading…
Reference in a new issue