codersforcauses/p2s-frontend

View on GitHub
src/mixins/title.js

Summary

Maintainability
A
0 mins
Test Coverage
// eslint-disable-next-line consistent-return
function getTitle(vm) {
  const { title } = vm.$options;
  if (title) {
    return typeof title === 'function' ? title.call(vm) : title;
  }
}

export default {
  created() {
    const title = getTitle(this);
    if (title) {
      document.title = title;
    }
  },
};