@netang/quasar 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -102,23 +102,44 @@
102
102
  </div>
103
103
  </div>
104
104
 
105
- <!-- 图片列表 -->
106
- <a
107
- v-for="(src, i) in currentImages"
108
- :key="`${src}-${i}`"
109
- :href="src"
110
- target="_blank"
111
- class="non-selectable no-outline"
112
- >
113
- <img
114
- :ref="(el) => (imgRefs[i] = el)"
115
- :src="src"
116
- :style="imgStyle"
117
- @load="handleImgLoad"
118
- @error="handleImgError"
119
- v-show="i === activeIndex"
120
- />
121
- </a>
105
+
106
+ <!-- 图片列表(有点击事件) -->
107
+ <template v-if="isClickImg">
108
+ <div
109
+ v-for="(src, i) in currentImages"
110
+ :key="`${src}-${i}`"
111
+ class="non-selectable no-outline"
112
+ @click="onClickImg({ src })"
113
+ >
114
+ <img
115
+ :ref="(el) => (imgRefs[i] = el)"
116
+ :src="src"
117
+ :style="imgStyle"
118
+ @load="handleImgLoad"
119
+ @error="handleImgError"
120
+ v-show="i === activeIndex"
121
+ />
122
+ </div>
123
+ </template>
124
+ <!-- 图片列表(点击跳转原图) -->
125
+ <template v-else>
126
+ <a
127
+ v-for="(src, i) in currentImages"
128
+ :key="`${src}-${i}`"
129
+ :href="src"
130
+ target="_blank"
131
+ class="non-selectable no-outline"
132
+ >
133
+ <img
134
+ :ref="(el) => (imgRefs[i] = el)"
135
+ :src="src"
136
+ :style="imgStyle"
137
+ @load="handleImgLoad"
138
+ @error="handleImgError"
139
+ v-show="i === activeIndex"
140
+ />
141
+ </a>
142
+ </template>
122
143
 
123
144
  </div>
124
145
  </q-dialog>
@@ -128,10 +149,15 @@
128
149
  import { computed, nextTick, onMounted, ref, watch } from 'vue'
129
150
  import { useDialogPluginComponent } from 'quasar'
130
151
 
152
+ import $n_get from 'lodash/get'
153
+
131
154
  import $n_forEach from '@netang/utils/forEach'
155
+ import $n_run from '@netang/utils/run'
132
156
 
133
157
  import $n_getImage from '../../../utils/getImage'
134
158
 
159
+ import { configs } from '../../../utils/config'
160
+
135
161
  export default {
136
162
 
137
163
  /**
@@ -259,6 +285,9 @@ export default {
259
285
  // 模式
260
286
  const isContain = ref(true)
261
287
 
288
+ // 图片是否可点击
289
+ const isClickImg = ref($n_get(configs, 'components.imgViewer.isClickImg') === true)
290
+
262
291
  // 转换效果
263
292
  const transform = ref({
264
293
  scale: 1,
@@ -519,6 +548,13 @@ export default {
519
548
  }
520
549
  }
521
550
 
551
+ /**
552
+ * 点击图片
553
+ */
554
+ function onClickImg(e) {
555
+ $n_run($n_get(configs, 'components.imgViewer.onClickImg'))(e)
556
+ }
557
+
522
558
  // ==========【声明周期】=========================================================================================
523
559
 
524
560
  /**
@@ -551,6 +587,8 @@ export default {
551
587
  isContain,
552
588
  // 转换效果
553
589
  transform,
590
+ // 图片是否可点击
591
+ isClickImg,
554
592
 
555
593
  // 当前图片数组
556
594
  currentImages,
@@ -583,6 +621,8 @@ export default {
583
621
  handleActions,
584
622
  // 点击遮蔽
585
623
  onMask,
624
+ // 点击图片
625
+ onClickImg,
586
626
  }
587
627
  }
588
628
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@netang/quasar",
3
- "version": "0.2.5",
3
+ "version": "0.2.7",
4
4
 
5
5
  "description": "netang-quasar",
6
6
  "scripts": {
package/utils/$power.js CHANGED
@@ -1237,6 +1237,10 @@ async function request(options) {
1237
1237
  */
1238
1238
  async function onRequest() {
1239
1239
 
1240
+ if ($n_has(o.powerBtn.data, 'formatRequestData')) {
1241
+ o.powerBtn.data.formatRequestData({ requestData })
1242
+ }
1243
+
1240
1244
  // 请求前执行
1241
1245
  const resBefore = await $n_runAsync(o.requestBefore)({
1242
1246
  options: o,