12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485 |
- <template>
- <text
- class="u-link"
- @tap.stop="openLink"
- :style="[linkStyle, $u.addStyle(customStyle)]"
- >{{text}}</text>
- </template>
- <script>
- import props from './props.js';
- import mpMixin from '../../libs/mixin/mpMixin.js';
- import mixin from '../../libs/mixin/mixin.js';
-
- export default {
- name: "u-link",
- mixins: [mpMixin, mixin, props],
- computed: {
- linkStyle() {
- const style = {
- color: this.color,
- fontSize: uni.$u.addUnit(this.fontSize),
-
- lineHeight: uni.$u.addUnit(uni.$u.getPx(this.fontSize) + 2),
- textDecoration: this.underLine ? 'underline' : 'none'
- }
-
-
-
-
- return style
- }
- },
- methods: {
- openLink() {
-
- plus.runtime.openURL(this.href)
-
-
- window.open(this.href)
-
-
- uni.setClipboardData({
- data: this.href,
- success: () => {
- uni.hideToast();
- this.$nextTick(() => {
- uni.$u.toast(this.mpTips);
- })
- }
- });
-
- this.$emit('click')
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "../../libs/css/components.scss";
- $u-link-line-height:1 !default;
- .u-link {
-
- line-height: $u-link-line-height;
-
- @include flex;
- flex-wrap: wrap;
- flex: 1;
- }
- </style>
|