GithubHelp home page GithubHelp logo

leotaozeng / vue-airbnb-ssr Goto Github PK

View Code? Open in Web Editor NEW
11.0 2.0 1.0 1.33 MB

Airbnb-Clone (server-side rendering) using Element Plus, Vue 3 along with Vite.

JavaScript 6.68% HTML 0.57% Vue 54.05% TypeScript 37.70% SCSS 1.00%
typescript vite vue element-plus vue-i18n pinia vue-router

vue-airbnb-ssr's Introduction

Vue 3 + Typescript + Vite

This template should help get you started developing with Vue 3 and Typescript in Vite. The template uses Vue 3 <script setup> SFCs, check out the script setup docs to learn more.

Recommended IDE Setup

Type Support For .vue Imports in TS

Since TypeScript cannot handle type information for .vue imports, they are shimmed to be a generic Vue component type by default. In most cases this is fine if you don't really care about component prop types outside of templates. However, if you wish to get actual prop types in .vue imports (for example to get props validation when using manual h(...) calls), you can enable Volar's Take Over mode by following these steps:

  1. Run Extensions: Show Built-in Extensions from VSCode's command palette, look for TypeScript and JavaScript Language Features, then right click and select Disable (Workspace). By default, Take Over mode will enable itself if the default TypeScript extension is disabled.
  2. Reload the VSCode window by running Developer: Reload Window from the command palette.

You can learn more about Take Over mode here.

vue-airbnb-ssr's People

Contributors

leotaozeng avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sml782

vue-airbnb-ssr's Issues

npm run dev运行时候报错,请问这种情况该怎么办,谷歌搜索也没解决

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Not working for prod

hey, really cool project, it really helped me. However, I have a problem in prod. if I build the project with build:ssr and start it on a server with prod:ssr, then the axios requests no longer work with the proxy.

The requests are displayed in the network tab but the response is simply the index.html:
image

Could it be because I don't use a router? I have removed everything that has to do with routers. However, everything works locally with dev:ssr.

My package.json scripts:

"dev:ssr": "cross-env NODE_ENV=development npx node-dev server",
"prod:ssr": "cross-env NODE_ENV=production npx node-dev server",
"build:ssr": "npm run build:client && npm run build:server",
"build:client": "vite build --ssrManifest --outDir dist/client",
"build:server": "vite build --ssr src/entry-server.js --outDir dist/server",

My vite.config.ts:

import {fileURLToPath, URL} from 'url'

import {defineConfig, loadEnv} from 'vite'
import vue from '@vitejs/plugin-vue'

export default defineConfig(({ command, mode }) => {
    const env = loadEnv(mode, process.cwd())

    return {
        plugins: [vue()],
        resolve: {
            alias: {
                '@': fileURLToPath(new URL('./src', import.meta.url))
            }
        },
        server: {
            proxy: {
                "/api": {
                    target: `https://${env.VITE_DASHBOARD_SUB}.${env.VITE_DOMAIN}`,
                    changeOrigin: true
                },
                "/tebex": {
                    target: "https://plugin.tebex.io",
                    changeOrigin: true,
                    rewrite: (path) => path.replace(/^\/tebex/, ""),
                    headers: {
                        'X-Tebex-Secret': env.VITE_TEBEX_SECRET
                    }
                }
            }
        },
        css: {
            preprocessorOptions: {
                scss: {
                    quietDeps: true,
                    additionalData: `
                    @use 'aos/dist/aos.css';
                    @use 'sweetalert2/src/sweetalert2.scss';
                    @use '@/assets/scss/sweetalert.scss';
                    @use '@/assets/scss/fonts.scss';
                    @use '@/assets/scss/slides/slides.scss';
                `
                }
            }
        }
    }
})

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.