Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Vue.js 在Vert.x上运行Vuetify(带ES4X)_Vue.js_Vuetify.js_Vert.x - Fatal编程技术网

Vue.js 在Vert.x上运行Vuetify(带ES4X)

Vue.js 在Vert.x上运行Vuetify(带ES4X),vue.js,vuetify.js,vert.x,Vue.js,Vuetify.js,Vert.x,我想知道是否可以使用Vert.x运行Vuetify(开箱即用)。我已经玩了一点,我没有看到一个简单的方法,但也许我错过了一些东西 资料来源: 步骤: 创建现成的Vuetify: npm install @vue/cli -g vue create my-app cd my-app vue add vuetify 通过在节点中运行它来测试它是否工作 npm run start 当我查看(使用节点)时,它看起来不错。所以我 在dist文件夹中创建编译版本 npm run buil

我想知道是否可以使用Vert.x运行Vuetify(开箱即用)。我已经玩了一点,我没有看到一个简单的方法,但也许我错过了一些东西

资料来源:

  • 步骤:

    创建现成的Vuetify:

     npm install @vue/cli -g
     vue create my-app
     cd my-app
     vue add vuetify
    
    通过在节点中运行它来测试它是否工作

     npm run start
    
    当我查看(使用节点)时,它看起来不错。所以我 在dist文件夹中创建编译版本

     npm run build
    
    现在我想尝试让它在Vert.x中工作,所以我添加了ES4X,它应该允许ES5+js代码

    npm install -g es4x-pm
    es4x init
    npm install @vertx/unit --save-dev
    npm install @vertx/core --save-prod
    npm install @vertx/web --save-prod
    npm install
    
    创建index.js文件,以便为index.html创建vert.x服务器

    vertx.createHttpServer().requestHandler(function (req){
      req.response().sendFile("dist/index.html");
    }).listen(8080);
    
    运行Vert.x

    npm start
    

    当我查看时,它并没有按预期显示。它看起来像一个空白页。当我在浏览器中查看页面的源代码时,它会显示index.html文件的内容。所以我知道它正在加载它,只是没有解释它。当我查看控制台时,我看到一个日志条目,上面写着语法错误:Expected expression,get'如果您添加了一个裸请求处理程序,请将其视为仅使用核心
    nodejs
    模块。为了提供多个文件和资源,您应该使用
    vertxweb
    (已安装)。在这种情况下,您的代码应该是:

    import { Router, StaticHandler } from '@vertx/web';
    
    // router acts like express if you're familiar with it
    const app = Router.router(vertx);
    
    // for any HTTP GET request this will be your
    // first handler "dist" is your static files root dir
    app.get().handler(StaticHandler.create("dist"));
    // add more handlers as needed...
    
    vertx.createHttpServer()
      .requestHandler(app)
      .listen(8080);
    

    因此,现在应该正确地提供所有静态文件了…

    您已经添加了一个裸请求处理程序,可以将其视为只使用核心
    nodejs
    模块。为了提供多个文件和资源,您应该使用
    vertxweb
    (已安装)。在这种情况下,您的代码应该是:

    import { Router, StaticHandler } from '@vertx/web';
    
    // router acts like express if you're familiar with it
    const app = Router.router(vertx);
    
    // for any HTTP GET request this will be your
    // first handler "dist" is your static files root dir
    app.get().handler(StaticHandler.create("dist"));
    // add more handlers as needed...
    
    vertx.createHttpServer()
      .requestHandler(app)
      .listen(8080);
    

    所以现在你所有的静态文件都应该被正确地提供了…

    我不确定我是不是在试探这个问题

    Vuetify在浏览器中运行,Es4x在服务器上运行

    您只需要找到一种方法来为静态“dist”文件夹提供服务,如上所述


    ps:我假设您没有进行服务器端渲染,在这种情况下,我不确定es4x是否可以工作(可能)。

    我不确定我是否在摸索这个问题

    Vuetify在浏览器中运行,Es4x在服务器上运行

    您只需要找到一种方法来为静态“dist”文件夹提供服务,如上所述

    ps:我假设您没有进行服务器端渲染,在这种情况下,我不确定es4x是否可以工作(可能)