1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <template>
- <text class="u-link" @tap.stop="openLink" :style="{
- color: color,
- fontSize: fontSize + 'rpx',
- borderBottom: underLine ? `1px solid ${lineColor ? lineColor : color}` : 'none',
- paddingBottom: underLine ? '0rpx' : '0'
- }">
- <slot></slot>
- </text>
- </template>
- <script>
-
- export default {
- name: "u-link",
- props: {
-
- color: {
- type: String,
- default: '#2979ff'
- },
-
- fontSize: {
- type: [String, Number],
- default: 28
- },
-
- underLine: {
- type: Boolean,
- default: false
- },
-
- href: {
- type: String,
- default: ''
- },
-
- mpTips: {
- type: String,
- default: '链接已复制,请在浏览器打开'
- },
-
- lineColor: {
- type: String,
- default: ''
- }
- },
- methods: {
- openLink() {
-
- plus.runtime.openURL(this.href)
-
-
- window.open(this.href)
-
-
- uni.setClipboardData({
- data: this.href,
- success: () => {
- uni.hideToast();
- this.$nextTick(() => {
- this.$u.toast(this.mpTips);
- })
- }
- });
-
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "../../libs/css/style.components.scss";
-
- .u-link {
- line-height: 1;
- }
- </style>
|