laravel-nuxt-js

Build a SPA with Laravel and Nuxt.
授权协议 MIT License
开发语言 JavaScript
所属分类 Web应用开发、 常用JavaScript包
软件类型 开源软件
地区 不详
投 递 者 徐佐
操作系统 跨平台
开源组织
适用人群 未知
 软件概览

Warning: this project has been deprecated

laravel-nuxt was created to offer some sugar when working locally with Laravel+Nuxt, solving some cookie problems in the process. Today, it isn't necessary anymore.

We recommend using Laravel Sanctum, which plays nicely with SPAs (see Sanctum's SPA Authentication section). If you can't migrate, just keep using laravel-nuxt.

Laravel Nuxt JS

This package allows you to build a SPA with Laravel and Nuxt.

I'm currently very busy so don't expect updates anytime soon. Please, check out m2sd/nuxt-laravel which is based on this repository but it's more active.

Installation

npm install laravel-nuxt

Attention! You must install the laravel-nuxt PHP package first.

Getting Started

Optionally, you will want to get rid of the default Laravel scaffolding.

Add a script to your package.json like this:

{
    "scripts": {
        "start": "laravel-nuxt"
    },
}

Wrap you nuxt.config.js's export with laravelNuxt:

const laravelNuxt = require("laravel-nuxt");

module.exports = laravelNuxt({
  // Your Nuxt options here...
  modules: [],
  plugins: [],

  // Options such as mode, srcDir and generate.dir are already handled for you.
});

Populate resources/nuxt/pages/index.vue inside your project:

<template>
  <h1>Hello {{ name }}!</h1>
</template>

<script>
export default {
  data: () => {
    return { name: 'world' };
  },
};
</script>

And then run:

npm start

Go to http://localhost:8000.

Commands

Development

laravel-nuxt dev

Starts both Nuxt and Laravel artisan servers in development mode (hot-module reloading, error reporting, etc).

Production

laravel-nuxt build

Compiles the application for production deployment.

This command will output the compiled assets in public/_nuxt.

Analysis

laravel-nuxt build -a

Launch webpack-bundle-analyzer to optimize your bundles.

Other

Getting rid of the default Laravel scaffolding

The default Laravel installation comes with some frontend files which are not needed anymore.

You can remove the following files and directories:

  • resources/assets/
  • package.json
  • package-lock.json
  • webpack.mix.js
 相关资料
  • Laravel-Nuxt A Laravel-Nuxt starter project template. Features Nuxt 2 Laravel 8 SPA or SSR Socialite integration VueI18n + ESlint + Bootstrap 4 + Font Awesome 5 Login, register, email verification and

  • Nuxt-ssr是一个文章增删改查的SSR项目 Nuxt.js该项目是一个ssr结构完整的项目,适合新人练手使用,如果对您有帮助,请右上角给个star,鼓励一下,同时希望指正。也可以加 nuxt技术交流群,大家一起相互学习,相互成长。 用到的技术 Vue.js v2.0.0 Nuxt.js v1.0.0 Node.js v9.8.0 (必须>=8.0) Express.js v4.x MongoD

  • 如果你打算用自己的中间件和 API 运行你的服务端的话,你可以以编程的形式将 Nuxt.js 集成到你原有的应用中去。 因为 Nuxt.js 基于 ES2015 编写,所以它的代码相对来说更有趣、更易读。它没用到任何的转译器,只依赖于 V8 内核中已经实现的功能。因此,Nuxt.js 需要 Node.js 4.0 或更高的运行环境。 你可以这样引入 Nuxt.js: const { Nuxt }

  • Get the latest Nuxt news to your inbox, curated by the core team and contributors.

  • 介绍 nuxt-juejin-project 是一个使用 Nuxt.js 仿写掘金的学习项目,主要使用 :nuxt + koa + vuex + axios + element-ui。该项目所有数据与掘金同步,因为接口都是通过 koa 作为中间层转发(找接口真是个累活 �� ),重新定义接口路由以及对部分接口数据做处理。页面主要数据通过 asyncData 在服务端渲染。在写项目时我会尽可能的使用

  • Nuxt.js具有完全模块化的架构,允许开发人员使用灵活的API扩展Nuxt Core的任何部分。 如果有兴趣开发自己的模块,请查看 Modules 教程 获取更多详细信息。 本节有助于熟悉Nuxt内部,并可以作为参考,在编写自己的模块时更好地理解它。 Core 这些类是Nuxt的核心,应该在运行时和构建时都存在。 Nuxt Nuxt Class 来源: core/nuxt.js Renderer