我无法弄清楚如何在Vue CLI项目中拥有多个页面.现在我的主页上有一些组件,我想创建另一个页面,但我不知道该怎么做.我应该创建多个html文件,默认情况下index.html是?在一个简单的文件结构中,css js img文件夹和html文件作为页面,我知道创建另一个html文件意味着创建另一个页面.但我不明白它如何与Vue CLI项目一起使用.
我在Vue文档中看到了诸如vue-router和"pages"之类的内容,但我对它们并不了解.我有什么选择?是否有一个指南详细解释,因为我找不到任何,更不用说详细了.如果你能提供帮助,我们将非常高兴!谢谢!
在Google上度过了一整天之后,我的问题仍未得到答复.
因为我是使用6.0.4版创建Angular应用程序的新手.我的第一个简单问题是:
是否可以使用多级登录页面配置Angular应用程序?
示例:如果没有公开根页面顶部导航栏上的链接,我需要直接链接到这些页面,用户拥有自己的不同菜单.喜欢:WordPress /管理面板与其网站不同.
/home 为公众观点 /admin 登录后的管理部分/customer 登录后的客户部分这是因为我发现只有一个app.component.html文件,我们可以使用路由包含我们的组件,但顶部有静态导航栏.
如果不:
如何运行为以上3个部分创建的多个应用程序可以在同一个下运行url:port?
我正在使用ViteJS制作一个静态多页面网站(html、scss 和 JS)制作一个静态多页面网站,但我找不到更改 html 文件的构建路径以将它们放入 dist 文件夹根目录的方法。
\n我的项目结构是:
\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 dist\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80...\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80src\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 pages\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 some-page.html\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80...\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 node_modules\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 pages\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 some-page.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 .gitignore\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 package-lock.json\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 package.json\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 vite.config.js\nRun Code Online (Sandbox Code Playgroud)\n而且我要:
\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 dist\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ...\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 some-page.html\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 ...\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 node_modules\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 src\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 pages\n \xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 some-page.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 .gitignore\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 index.html\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 package-lock.json\n\xe2\x94\x9c\xe2\x94\x80\xe2\x94\x80 package.json\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80 vite.config.js\nRun Code Online (Sandbox Code Playgroud)\n我的 vite.config.js (按照文档的建议)是:
\nconst { resolve } = require(\'path\')\nconst { defineConfig } = require(\'vite\')\n\nmodule.exports = defineConfig({\n build: {\n rollupOptions: {\n input: {\n main: resolve(__dirname, …Run Code Online (Sandbox Code Playgroud) 我正在创建一个多页面应用程序,并且创建了一个导航栏,其中包含指向不同页面(URL)的链接,该导航栏最近神秘地停止工作。我尝试将所有代码恢复到最后一次已知的良好状态,但它没有修复问题。目前,这仅在我的开发计算机上被破坏,实时应用程序仍然有效,但由于这个问题,我无法发布新版本。我在下面包含了所有相关代码的代码片段,并且希望能以新的眼光来看待这个问题,谢谢。
可能值得注意的是,如果我将 dbc.NavLink 更改为 dbc.Link 一切正常,但它布局不正确或在页面中具有活动按钮外观,因此这不是所需的选项。
这是我的版本
dash-bootstrap-components 0.7.1
dash-core-components 1.8.0
dash-html-components 1.0.2
Run Code Online (Sandbox Code Playgroud)
应用程序.py
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
from server import app
app.layout = htm.Div([
html.Link(rel='shortcut icon', href='assets/images/favicon/ico'),
dcc.Store(id='session-store', storage_type='session'),
dcc.Location(id='url', refresh=False),
html.Nav(id='navbar-container'),
html.Div(id='page-content')
])
Run Code Online (Sandbox Code Playgroud)
导航栏.py
import dash_bootstrap_components as dbc
import dash_core_components as dcc
import dash_html_components as html
def navbar():
layout = html.Nav([
dbc.Nav([
dbc.NavItem(dbc.NavLink('Home', id='home-link', href='/')),
dbc.NavItem(dbc.NavLink('Employees', id='employee-link', href='/employees')),
dbc.NavItem(dbc.NavLink('Programs', id='programs-link', href='/programs')),
dbc.NavItem(dbc.NavLink('Capacity', id='capacity-link', href='/capacity'))
],
pills=True,
id='navbar')
])
Run Code Online (Sandbox Code Playgroud)
回调.py
from …Run Code Online (Sandbox Code Playgroud) 我有一个多页 Vue.js 应用程序,其中包含有关域/法律的工作页面;域/提交;等等。我在 Vue.js页面的帮助下实现了它(即定制vue.config.js)
换句话说,我很好地完成了上述工作。
我现在正在尝试在新的子目录级别下实现更多的嵌套页面(除了上面我已经拥有的页面)。IE
有什么办法可以通过自定义来完成这项工作vue.config.js?
当前尝试vue.config.js代码:
module.exports = {
pages: {
index: {
entry: "./src/pages/home/main.js",
template: "public/index.html",
title: "Home",
chunks: ["chunk-vendors", "chunk-common", "index"],
},
legal: {
entry: "./src/pages/legal/main.js",
template: "public/index.html",
title: "Legal",
chunks: ["chunk-vendors", "chunk-common", "legal"],
},
submit: {
entry: "./src/pages/submit/main.js",
template: "public/index.html",
title: "Submit",
chunks: ["chunk-vendors", "chunk-common", "submit"],
},
org: {
digitalocean: {
entry: "./src/pages/org/digitalocean/main.js",
template: "public/index.html",
title: "Digital Ocean",
chunks: ["chunk-vendors", "chunk-common", …Run Code Online (Sandbox Code Playgroud) 我目前正在将 Webpack 集成到现有的服务器端渲染的多页面应用程序中,以利用 Webpack 周围的现代工具和生态系统。
这主要是一次很好的体验,但我目前正在努力将其集成到我们的服务器端代码中,特别是使用散列和平面文件夹结构进行生产构建。基本思想非常简单:所有资产都由 Webpack 管理,并在webpack-manifest-plugin我的帮助下生成一个由服务器端应用程序读取的 manifest.json。通过辅助函数,我可以将类似的路径static/images/logo.png变成logo-[hash].png.
这对于 js/css 文件非常有用(其中只有我的入口点的包名称相关),但我在生成包含图像和文档等静态资产所需的必要信息的 manifest.json 文件时遇到问题。
部分Webpack配置
这是我的 webpack 配置的相关部分:
{
entry: {
index: './js/app.js',
"static-assets": './js/static-assets.js'
},
output: {
filename: '[name].js'
},
resolve: {
alias: {
"vendor-assets": "dependencyX/assets",
}
},
plugins: [
new WebpackManifestPlugin()
],
module: {
rules: [
{
test: /\.(png|svg|jpg|gif)$/,
use: [
{
loader: 'file-loader',
options: {
name: isDev ? '[path][name].[ext]' : '[hash].[ext]',
}
}
]
}
]
}
}
Run Code Online (Sandbox Code Playgroud)
方法一:copy-webpack-plugin …
当我尝试访问页面“/admin/dashboard”时,从src/Client/App.vue. 我想在同一域中使用不同的 vue、vuex、vue-router 基础将管理员和用户分开。是否可以?我的项目树。
public/
-> admin/
-> index.html
-> index.hmtl
src/
-> Admin/
-> components/
-> admin.ts
-> App.vue
-> router.ts
-> Client/
-> components/
-> admin.ts
-> App.vue
-> router.ts
vue.config.js
Run Code Online (Sandbox Code Playgroud)
src/Admin/router.ts
export default new Router({
mode: 'history',
base: '/admin/',
routes: [
{
path: '/dashboard',
name: 'dashboard',
component: Dashboard,
},
],
});
Run Code Online (Sandbox Code Playgroud)
src/客户端/router.ts
export default new Router({
mode: 'history',
base: '/',
routes: [
{
path: '/',
name: 'home',
component: Home,
},
],
});
Run Code Online (Sandbox Code Playgroud)
vue.config.js
module.exports = …Run Code Online (Sandbox Code Playgroud) Svelte文档指出:
Svelte 在构建时将您的应用程序转换为理想的 JavaScript,而不是在运行时解释您的应用程序代码。
...
它类似于 React 和 Vue 等 JavaScript 框架......
在上述背景下,我的问题是:
Svelte 是否仅限于构建单页应用程序 (SPA),是否可以用于创建多页应用程序 (MPA)?
javascript single-page-application svelte multi-page-application