v1.0
This commit is contained in:
7
uni_modules/uv-link/changelog.md
Normal file
7
uni_modules/uv-link/changelog.md
Normal file
@ -0,0 +1,7 @@
|
||||
## 1.0.2(2023-08-13)
|
||||
1. 修复报错的BUG
|
||||
## 1.0.1(2023-05-16)
|
||||
1. 优化组件依赖,修改后无需全局引入,组件导入即可使用
|
||||
2. 优化部分功能
|
||||
## 1.0.0(2023-05-10)
|
||||
uv-link 超链接组件
|
40
uni_modules/uv-link/components/uv-link/props.js
Normal file
40
uni_modules/uv-link/components/uv-link/props.js
Normal file
@ -0,0 +1,40 @@
|
||||
export default {
|
||||
props: {
|
||||
// 文字颜色
|
||||
color: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 字体大小,单位px
|
||||
fontSize: {
|
||||
type: [String, Number],
|
||||
default: 14
|
||||
},
|
||||
// 是否显示下划线
|
||||
underLine: {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
// 要跳转的链接
|
||||
href: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 小程序中复制到粘贴板的提示语
|
||||
mpTips: {
|
||||
type: String,
|
||||
default: '链接已复制,请在浏览器打开'
|
||||
},
|
||||
// 下划线颜色
|
||||
lineColor: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
// 超链接的问题,不使用slot形式传入,是因为nvue下无法修改颜色
|
||||
text: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
...uni.$uv?.props?.link
|
||||
}
|
||||
}
|
83
uni_modules/uv-link/components/uv-link/uv-link.vue
Normal file
83
uni_modules/uv-link/components/uv-link/uv-link.vue
Normal file
@ -0,0 +1,83 @@
|
||||
<template>
|
||||
<text
|
||||
class="uv-link"
|
||||
@tap.stop="openLink"
|
||||
:style="[linkStyle, $uv.addStyle(customStyle)]"
|
||||
>{{text}}</text>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import mpMixin from '@/uni_modules/uv-ui-tools/libs/mixin/mpMixin.js'
|
||||
import mixin from '@/uni_modules/uv-ui-tools/libs/mixin/mixin.js'
|
||||
import props from './props.js';
|
||||
/**
|
||||
* link 超链接
|
||||
* @description 该组件为超链接组件,在不同平台有不同表现形式:在APP平台会通过plus环境打开内置浏览器,在小程序中把链接复制到粘贴板,同时提示信息,在H5中通过window.open打开链接。
|
||||
* @tutorial https://www.uvui.cn/components/link.html
|
||||
* @property {String} color 文字颜色 (默认 color['uv-primary'] )
|
||||
* @property {String | Number} fontSize 字体大小,单位px (默认 15 )
|
||||
* @property {Boolean} underLine 是否显示下划线 (默认 false )
|
||||
* @property {String} href 跳转的链接,要带上http(s)
|
||||
* @property {String} mpTips 各个小程序平台把链接复制到粘贴板后的提示语(默认“链接已复制,请在浏览器打开”)
|
||||
* @property {String} lineColor 下划线颜色,默认同color参数颜色
|
||||
* @property {String} text 超链接的问题,不使用slot形式传入,是因为nvue下无法修改颜色
|
||||
* @property {Object} customStyle 定义需要用到的外部样式
|
||||
*
|
||||
* @example <uv-link href="http://www.uvui.cn">蜀道难,难于上青天</uv-link>
|
||||
*/
|
||||
export default {
|
||||
name: "uv-link",
|
||||
emits:['click'],
|
||||
mixins: [mpMixin, mixin, props],
|
||||
computed: {
|
||||
linkStyle() {
|
||||
const style = {
|
||||
color: this.color,
|
||||
fontSize: this.$uv.addUnit(this.fontSize),
|
||||
// line-height设置为比字体大小多2px
|
||||
lineHeight: this.$uv.addUnit(this.$uv.getPx(this.fontSize) + 2),
|
||||
textDecoration: this.underLine ? 'underline' : 'none'
|
||||
}
|
||||
return style
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
openLink() {
|
||||
// #ifdef APP-PLUS
|
||||
plus.runtime.openURL(this.href)
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
window.open(this.href)
|
||||
// #endif
|
||||
// #ifdef MP
|
||||
uni.setClipboardData({
|
||||
data: this.href,
|
||||
success: () => {
|
||||
uni.hideToast();
|
||||
this.$nextTick(() => {
|
||||
this.$uv.toast(this.mpTips);
|
||||
})
|
||||
}
|
||||
});
|
||||
// #endif
|
||||
this.$emit('click')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
@import '@/uni_modules/uv-ui-tools/libs/css/components.scss';
|
||||
@import '@/uni_modules/uv-ui-tools/libs/css/color.scss';
|
||||
$uv-link-line-height:1 !default;
|
||||
|
||||
.uv-link {
|
||||
/* #ifndef APP-NVUE */
|
||||
line-height: $uv-link-line-height;
|
||||
/* #endif */
|
||||
@include flex;
|
||||
flex-wrap: wrap;
|
||||
flex: 1;
|
||||
color: $uv-primary;
|
||||
}
|
||||
</style>
|
87
uni_modules/uv-link/package.json
Normal file
87
uni_modules/uv-link/package.json
Normal file
@ -0,0 +1,87 @@
|
||||
{
|
||||
"id": "uv-link",
|
||||
"displayName": "uv-link 超链接 全面兼容小程序、nvue、vue2、vue3等多端",
|
||||
"version": "1.0.2",
|
||||
"description": "uv-link 该组件为超链接组件",
|
||||
"keywords": [
|
||||
"uv-link",
|
||||
"uvui",
|
||||
"uv-ui",
|
||||
"link",
|
||||
"超链接"
|
||||
],
|
||||
"repository": "",
|
||||
"engines": {
|
||||
"HBuilderX": "^3.1.0"
|
||||
},
|
||||
"dcloudext": {
|
||||
"type": "component-vue",
|
||||
"sale": {
|
||||
"regular": {
|
||||
"price": "0.00"
|
||||
},
|
||||
"sourcecode": {
|
||||
"price": "0.00"
|
||||
}
|
||||
},
|
||||
"contact": {
|
||||
"qq": ""
|
||||
},
|
||||
"declaration": {
|
||||
"ads": "无",
|
||||
"data": "插件不采集任何数据",
|
||||
"permissions": "无"
|
||||
},
|
||||
"npmurl": ""
|
||||
},
|
||||
"uni_modules": {
|
||||
"dependencies": [
|
||||
"uv-ui-tools"
|
||||
],
|
||||
"encrypt": [],
|
||||
"platforms": {
|
||||
"cloud": {
|
||||
"tcb": "y",
|
||||
"aliyun": "y"
|
||||
},
|
||||
"client": {
|
||||
"Vue": {
|
||||
"vue2": "y",
|
||||
"vue3": "y"
|
||||
},
|
||||
"App": {
|
||||
"app-vue": "y",
|
||||
"app-nvue": "y"
|
||||
},
|
||||
"H5-mobile": {
|
||||
"Safari": "y",
|
||||
"Android Browser": "y",
|
||||
"微信浏览器(Android)": "y",
|
||||
"QQ浏览器(Android)": "y"
|
||||
},
|
||||
"H5-pc": {
|
||||
"Chrome": "y",
|
||||
"IE": "y",
|
||||
"Edge": "y",
|
||||
"Firefox": "y",
|
||||
"Safari": "y"
|
||||
},
|
||||
"小程序": {
|
||||
"微信": "y",
|
||||
"阿里": "y",
|
||||
"百度": "y",
|
||||
"字节跳动": "y",
|
||||
"QQ": "y",
|
||||
"钉钉": "u",
|
||||
"快手": "u",
|
||||
"飞书": "u",
|
||||
"京东": "u"
|
||||
},
|
||||
"快应用": {
|
||||
"华为": "u",
|
||||
"联盟": "u"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
11
uni_modules/uv-link/readme.md
Normal file
11
uni_modules/uv-link/readme.md
Normal file
@ -0,0 +1,11 @@
|
||||
## Link 超链接
|
||||
|
||||
> **组件名:uv-link**
|
||||
|
||||
该组件为超链接组件,在不同平台有不同表现形式。
|
||||
|
||||
### <a href="https://www.uvui.cn/components/link.html" target="_blank">查看文档</a>
|
||||
|
||||
### [完整示例项目下载 | 关注更多组件](https://ext.dcloud.net.cn/plugin?name=uv-ui)
|
||||
|
||||
#### 如使用过程中有任何问题,或者您对uv-ui有一些好的建议,欢迎加入 uv-ui 交流群:<a href="https://ext.dcloud.net.cn/plugin?id=12287" target="_blank">uv-ui</a>、<a href="https://www.uvui.cn/components/addQQGroup.html" target="_blank">官方QQ群</a>
|
Reference in New Issue
Block a user