Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <div id="app">
- {{ name() }}
- {{ me.lastVisit | moment('DD.MM.YYYY') }}
- </div>
- <script>
- // Global Vue Filter
- // include moment.js
- Vue.filter('moment', function (value, format)
- {
- var format = format || "YYYY-MM-DD";
- return moment.unix(value).format(format)
- });
- var app = new Vue({
- el: '#app',
- data: {
- me: {
- firstname: "John",
- lastname: "Doe",
- lastVisit: 1560492819
- }
- },
- methods: {
- name: function ()
- {
- return this.me.firstname + ' ' + this.me.lastname;
- }
- },
- mounted: function ()
- {
- // Set Page Title
- document.title = this.name();
- },
- computed: {
- },
- watch: {
- me: function ()
- {
- document.title = this.name();
- }
- },
- filters: {
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement