1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283 |
- <template>
- <text
- class="u-link"
- @tap.stop="openLink"
- :style="[linkStyle, $u.addStyle(customStyle)]"
- >{{text}}</text>
- </template>
- <script>
- import props from './props.js';
-
- export default {
- name: "u-link",
- mixins: [uni.$u.mpMixin, uni.$u.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>
|