0

i created a dashboard using vue.js but i have earlier created simple web pages using basic Html and CSS . Is there any method of redirecting the Html page to vue dashboard on click of a button . Vue dashboard is a different project

1 Answer 1

3

It is better and easier to just transform the static HTML page into a component by simply creating a component and copy pasting the static HTML code inside the component template however if you insist on importing the file as HTML format you might need to install a package called html-loader with :

yarn add html-loader | npm install html-loader

Then you need to update your webpack.config.js file with :

{
   test: /\.(html)$/,
   exclude: /(node_modules)/,
   use: {
   oader: "html-loader"
   }
}

Then you import the HTML file with :

 import FileName from '/path/to/yourFilePath.html'

And finally you nest the template inside your router config :

 {
  path: '/path',
  name: 'routeName',
  component: { template: FileName}
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.