creativetimofficial / tailwind-starter-kit

Tailwind Starter Kit a beautiful extension for TailwindCSS, Free and Open Source
https://www.creative-tim.com/learning-lab/tailwind-starter-kit#/presentation
MIT License
5.69k stars 890 forks source link

Routes not working OOTB #5

Closed Swader closed 4 years ago

Swader commented 4 years ago

I expected the routes to work by simple adding new components and defining new routes, but it seems to need extra configuration. This is how I extended the Dashboard page's main.js:

import Vue from 'vue'
import Home from './views/Home.vue'
import About from './views/About.vue'

import "@fortawesome/fontawesome-free/css/all.min.css";

Vue.config.productionTip = false

const routes = {
  '/': Home,
  '/about': About
}

new Vue({
  data: {
    currentRoute: window.location.pathname
  },
  computed: {
    ViewComponent () {
      return routes[this.currentRoute] || Home
    }
  },
  render (h) { return h(this.ViewComponent) },
}).$mount('#app')

I have created the Home component by renaming the Dashboard component, and created the About component. How do I make it respect these routes?

einazare commented 4 years ago

Hello there, @Swader ,

We're sorry, but this is an only page starter - it is only made to showcase you how to use tailwindcss to style a VueJS page. Please refer to VueJS routing:

Best, Manu

Swader commented 4 years ago

Understood, thanks