1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
| <template>
| <view class="link-edit-container" v-if="showPopup">
| <view class="link-edit">
| <view class="title">添加链接</view>
| <view class="edit">
| <view class="description">
| 链接描述:
| <input v-model="descVal" type="text" class="input" placeholder="请输入链接描述" />
| </view>
| <view class="address">
| 链接地址:
| <input v-model="addrVal" type="text" class="input" placeholder="请输入链接地址" />
| </view>
| </view>
| <view class="control">
| <view class="cancel" @click="close">取消</view>
| <view class="confirm" @click="onConfirm">确认</view>
| </view>
| </view>
| <view class="mask"></view>
| </view>
| </template>
|
| <script>
| export default {
| data() {
| return {
| showPopup: false,
| descVal: '',
| addrVal: ''
| }
| },
| methods: {
| open() {
| this.showPopup = true
| this.$emit('open')
| },
| close() {
| this.showPopup = false
| this.descVal = ''
| this.addrVal = ''
| this.$emit('close')
| },
| onConfirm() {
| if (!this.descVal) {
| uni.showToast({
| title: '请输入链接描述',
| icon: 'none'
| })
| return
| }
| if (!this.addrVal) {
| uni.showToast({
| title: '请输入链接地址',
| icon: 'none'
| })
| return
| }
| this.$emit('confirm', {
| text: this.descVal,
| href: this.addrVal
| })
| this.close()
| }
| }
| }
| </script>
|
| <style lang="scss">
| .link-edit-container {
| .link-edit {
| width: 80%;
| position: absolute;
| top: 50%;
| left: 50%;
| transform: translate(-50%, -50%);
| background-color: #ffffff;
| box-shadow: -2px -2px 4px rgba(0, 0, 0, 0.05), 2px 2px 4px rgba(0, 0, 0, 0.05);
| border-radius: 12rpx;
| box-sizing: border-box;
| z-index: 999;
| font-size: 14px;
|
| .title {
| height: 80rpx;
| display: flex;
| justify-content: center;
| align-items: center;
| }
|
| .edit {
| padding: 24rpx;
| border-top: 1px solid #eeeeee;
| border-bottom: 1px solid #eeeeee;
| box-sizing: border-box;
|
| .input {
| flex: 1;
| padding: 4px;
| font-size: 14px;
| border: 1px solid #eeeeee;
| border-radius: 8rpx;
|
| .uni-input-placeholder {
| color: #dddddd;
| }
| }
|
| .description {
| display: flex;
| align-items: center;
| }
| .address {
| display: flex;
| align-items: center;
| margin-top: 24rpx;
| }
| }
|
| .control {
| height: 80rpx;
| display: flex;
| cursor: pointer;
|
| .cancel {
| flex: 1;
| color: #dd524d;
| display: flex;
| justify-content: center;
| align-items: center;
| }
| .confirm {
| border-left: 1px solid #eeeeee;
| flex: 1;
| color: #007aff;
| display: flex;
| justify-content: center;
| align-items: center;
| }
| }
| }
| .mask {
| position: absolute;
| top: 0;
| left: 0;
| right: 0;
| bottom: 0;
| background-color: rgba(0, 0, 0, 0.05);
| z-index: 998;
| }
| }
| </style>
|
|