【问题标题】:I have tried many solutions to integrate ASP.NET Core 6 MVC with Vue.js but solutions do not work, I install webpack, but webpack.config.js not exsit我尝试了许多将 ASP.NET Core 6 MVC 与 Vue.js 集成的解决方案,但解决方案不起作用,我安装了 webpack,但 webpack.config.js 不存在
【发布时间】:2022-01-08 14:43:02
【问题描述】:

这是我的package.json 文件,我使用的所有依赖项都已安装。

这是我的 index.js 文件,我称之为 vue 组件。

这是我的index.cshtml文件,我将vue的组件称为标签

package.json

{
    "name": "whoami",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "",
    "license": "ISC",
    "devDependencies": {
        "babel-core": "^6.26.3",
        "babel-loader": "^8.2.3",
        "babel-polyfill": "^6.26.0",
        "babel-preset-env": "^1.7.0",
        "npm-watch": "^0.11.0",
        "webpack": "^5.64.4"
    },
    "dependencies": {
        "@babel/core": "^7.16.0",
        "vue": "^2.6.14",
        "vue-loader": "^15.9.8",
        "webpack-cli": "^4.9.1"
    }
}

index.js:

import vue from "vue";
import HomeComponnent from "./Home/home.veu";
vue.component("app", require("./Home/home.vue").default);
new veu({
    el: "#app",
    HomeComponnent,
});

index.cshtml:

@{
    ViewData["Title"] = "Home Page";
}

<div id="app">
     <home-compponnet></home-compponnet>

</div>

@section script {
     <script sre="@Url.Content("~")"></script>
}

【问题讨论】:

    标签: vue.js webpack asp.net-core-mvc


    【解决方案1】:

    不是直接回答,而是省去很多麻烦,用Nuxt.js

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-05-04
      • 1970-01-01
      • 2023-02-22
      • 2017-01-30
      • 2015-03-22
      • 1970-01-01
      • 2021-07-24
      相关资源
      最近更新 更多