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

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

# 平台差异说明

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

# 基本使用

  • 通过href设置打开的链接,text设置显示的内容
<template>
	<up-link href="https://uviewui.com/" text="打开uview-plus UI文档" @click="click"></up-link>
</template>
<script setup>  
// 直接定义方法  
function click() {  
  console.log('click');  
}  
</script>
<script>
	export default {
		methods: {
			click() {
				console.log('click');
			}
		}
	}
</script>

# 下划线

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

<template>
	<up-link href="https://uviewui.com/" text="打开uview-plus UI文档" :under-line="true"></up-link>
</template>

# 自定义颜色

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

# 右侧演示页面源代码地址

点击以下链接以查看右侧演示页面的源码


 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 - -