Table of Contents
设置导航栏
修改端口
解决方案一:不推荐
解决方案二:
Home Web Front-end uni-app A brief analysis of how to set the navigation bar and modify the default port in uni-app

A brief analysis of how to set the navigation bar and modify the default port in uni-app

Sep 06, 2021 pm 07:08 PM
uni-app Navigation Bar

uni-app中怎么设置导航栏?怎么修改默认端口?下面本篇文章给大家介绍一下uni-app导航栏设置,以及在pages.json里面配置并修改默认端口的方法。

A brief analysis of how to set the navigation bar and modify the default port in uni-app

设置导航栏

全局导航栏样式设置: 在 pages.jsonglobalStyle 里进行各个参数配置。【相关推荐:《uniapp教程》】

"globalStyle": {
    "navigationBarTextStyle": "black",
    "navigationBarTitleText": "Hello uniapp",
    "navigationBarBackgroundColor": "#F8F8F8",
    "backgroundColor": "#F8F8F8",
    "backgroundColorTop": "#F4F5F6",
    "backgroundColorBottom": "#F4F5F6",
    "mp-alipay": {
        "titleBarColor": "#FFFFFF"
    }
},
Copy after login

单页面导航栏样式设置:每个 page 下面的 style 配置中的 navigationBar 各个参数配置,即为通用配置,小程序、app、h5均生效。参考style设置每个页面的状态栏、导航条、标题、窗口背景色等

{
    "path": "pages/index/index",
    "style": {
        "navigationBarTitleText": "主页",  
    }
},
Copy after login

我的一个demo的 pages.json 简单配置(这里引入了 uView)

{
	"easycom": { //uni-app为了调试性能的原因,修改easycom规则不会实时生效,配置完后,您需要重启HX或者重新编译项目才能正常使用uView的功能。
		"^u-(.*)": "@/uview-ui/components/u-$1/u-$1.vue"
	},
	"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
		{
			"path": "pages/index/index",
			"style": {
				"navigationBarTitleText": "首页"
			}
		}, {
			"path": "pages/class/index",
			"style": {
				"navigationBarTitleText": "分类"
			}
		},
		{
			"path": "pages/car/index",
			"style": {
				"navigationBarTitleText": "购物车"
			}
		},
		{
			"path": "pages/mine/index",
			"style": {
				"navigationBarTitleText": "我的"
			}
		},
		{
			"path": "pages/address/addSite",
			"style": {
				"navigationBarTitleText": "添加用户地址"
			}
		},
		{
			"path": "pages/address/index",
			"style": {
				"navigationBarTitleText": "用户地址"
			}
		}
	],
	//底部导航栏
	"tabBar": {
		"color": "#999", //当前字体颜色
		"selectedColor": "#333", //点击激活的字体颜色
		"backgroundColor": "#F0F3F6", //背景颜色
		"borderStyle": "white",
		"list": [{
				"text": "首页", //字体
				"iconPath": "static/tabs/home.png", // 当前图片的颜色
				"selectedIconPath": "static/tabs/home-active.png", // 选中图片的颜色
				"pagePath": "pages/index/index" //路径
			},
			{
				"text": "分类",
				"iconPath": "static/tabs/welfare.png",
				"selectedIconPath": "static/tabs/welfare-active.png",
				"pagePath": "pages/class/index"
			},
			{
				"text": "购物车",
				"iconPath": "static/tabs/shop-car.png",
				"selectedIconPath": "static/tabs/shop-caron.png",
				"pagePath": "pages/car/index"
			},
			{
				"text": "我的",
				"iconPath": "static/tabs/my.png",
				"selectedIconPath": "static/tabs/my-active.png",
				"pagePath": "pages/mine/index"
			}
		]
	},
	"globalStyle": {
		"navigationBarTextStyle": "black",
		"navigationBarTitleText": "异联盟",
		"navigationBarBackgroundColor": "#fff",
		"backgroundColor": "#F8F8F8",
		"backgroundTextStyle": "light"
	}
}
Copy after login

结果如下:

A brief analysis of how to set the navigation bar and modify the default port in uni-app

修改端口

uni-app 默认端口为 8080,与 tomcat 的默认端口冲突。

解决方案一:不推荐

先启动 tomcat,再启动 uni-app 端口会自动修改为 8081

解决方案二:

打开项目--->打开 manifest.json 文件,选择h5配置,设置端口就可以了。

A brief analysis of how to set the navigation bar and modify the default port in uni-app

更多编程相关知识,请访问:编程入门!!

The above is the detailed content of A brief analysis of how to set the navigation bar and modify the default port in uni-app. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to develop uni-app in VSCode? (Tutorial sharing) How to develop uni-app in VSCode? (Tutorial sharing) May 13, 2022 pm 08:11 PM

How to develop uni-app in VSCode? The following article will share with you a tutorial on developing uni-app in VSCode. This may be the best and most detailed tutorial. Come and take a look!

Use uniapp to develop a simple map navigation Use uniapp to develop a simple map navigation Jun 09, 2022 pm 07:46 PM

How to use uniapp to develop a simple map navigation? This article will provide you with an idea for making a simple map. I hope it will be helpful to you!

How to adjust the navigation bar at the top of Douyin? Other navigation bar adjustment options How to adjust the navigation bar at the top of Douyin? Other navigation bar adjustment options Mar 07, 2024 pm 02:50 PM

The navigation bar of the Douyin interface is located at the top and is an important channel for users to quickly access different functions and content. As Douyin continues to update, users may want to be able to customize and adjust the navigation bar according to their personal preferences and needs. 1. How to adjust the navigation bar at the top of Douyin? Usually, the top navigation bar of Douyin displays some popular channels, allowing users to quickly browse and view content of interest. If you want to adjust the settings for your top channel, just follow these steps: Open the TikTok app and log into your account. Find the navigation bar above the main interface, usually in the middle or top of the screen. Click the "+" symbol or similar button above the navigation bar to enter the channel editing interface. In the channel editing interface, you can see the default list of popular channels. You can pass

Implementation steps of implementing menu navigation bar with shadow effect using pure CSS Implementation steps of implementing menu navigation bar with shadow effect using pure CSS Oct 16, 2023 am 08:27 AM

The steps to implement a menu navigation bar with shadow effect using pure CSS require specific code examples. In web design, the menu navigation bar is a very common element. By adding a shadow effect to the menu navigation bar, you can not only increase its aesthetics, but also improve the user experience. In this article, we will use pure CSS to implement a menu navigation bar with a shadow effect, and provide specific code examples for reference. The implementation steps are as follows: Create HTML structure First, we need to create a basic HTML structure to accommodate the menu navigation bar. by

Let's talk about how to use uniapp to develop a snake game! Let's talk about how to use uniapp to develop a snake game! May 20, 2022 pm 07:56 PM

How to use uniapp to develop a snake game? The following article will take you step by step to implement the Snake game in uniapp. I hope it will be helpful to you!

How to encapsulate uni-app vue3 interface request How to encapsulate uni-app vue3 interface request May 11, 2023 pm 07:28 PM

uni-app interface, global method encapsulation 1. Create an api file in the root directory, create api.js, baseUrl.js and http.js files in the api folder 2.baseUrl.js file code exportdefault"https://XXXX .test03.qcw800.com/api/"3.http.js file code exportfunctionhttps(opts,data){lethttpDefaultOpts={url:opts.url,data:data,method:opts.method

Examples to explain how uniapp implements the all-select function of multi-select boxes Examples to explain how uniapp implements the all-select function of multi-select boxes Jun 22, 2022 am 11:57 AM

This article brings you relevant knowledge about uniapp, which mainly organizes the related issues of implementing the select-all function of the multi-select box. The reason why the select-all function cannot be implemented is that when the checked field of the checkbox is dynamically modified, the status on the interface can Real-time changes, but the change event of checkbox-group cannot be triggered. Let's take a look at it. I hope it will be helpful to everyone.

Take you step by step to develop a uni-app calendar plug-in (and publish it) Take you step by step to develop a uni-app calendar plug-in (and publish it) Jun 30, 2022 pm 08:13 PM

This article will guide you step by step in developing a uni-app calendar plug-in, and introduce how the next calendar plug-in is developed from development to release. I hope it will be helpful to you!

See all articles