该组件为超链接组件,在不同平台有不同表现形式:

  • 在APP平台会通过plus环境打开内置浏览器
  • 在小程序中把链接复制到粘贴板,同时提示信息
  • 在H5中通过window.open打开链接

# 平台差异说明

App(vue) App(nvue) H5 小程序

# 基本使用

  • 通过href设置打开的链接,text设置显示的内容
<template>
	<u-link href="https://uviewui.com/" text="打开uView UI文档" @click="click"></u-link>
</template>

<script>
	export default {
		methods: {
			click() {
				console.log('click');
			}
		}
	}
</script>
✅ Copy success!

# 下划线

通过under-line设置是否显示链接的下划线

<template>
	<u-link href="https://uviewui.com/" text="打开uView UI文档" :under-line="true"></u-link>
</template>
✅ Copy success!

# 自定义颜色

  • 通过color设置文字颜色
  • 通过line-color设置下划线颜色
<template>
	<u-link href="https://uviewui.com/" text="打开uView UI文档" color="#19be6b" line-color="#19be6b"></u-link>
</template>
✅ Copy success!

# 此页面源代码地址

页面源码地址


 github  gitee

# API

# Props

参数 说明 类型 默认值 可选值
color 文字颜色 String color['u-primary'] -
fontSize 字体大小,默认单位px String | Number 15 -
underLine 是否显示下划线 Boolean false true
href 跳转的链接,要带上http(s) String - -
mpTips 各个小程序平台把链接复制到粘贴板后的提示语 String 链接已复制,请在浏览器打开 -
lineColor 下划线颜色,默认同color参数颜色 String - -
text 超链接的问题,不使用slot形式传入,是因为nvue下无法修改颜色 String - -