u-upload.vue 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684
  1. <template>
  2. <view v-if="!disabled" class="u-upload">
  3. <view
  4. v-for="(item, index) in lists"
  5. v-if="showUploadList"
  6. :key="index"
  7. :style="{
  8. width: $u.addUnit(width),
  9. height: $u.addUnit(height)
  10. }"
  11. class="u-list-item u-preview-wrap"
  12. >
  13. <view
  14. v-if="deletable"
  15. :style="{
  16. background: delBgColor
  17. }"
  18. class="u-delete-icon"
  19. @tap.stop="deleteItem(index)"
  20. >
  21. <u-icon :color="delColor" :name="delIcon" class="u-icon" size="20"></u-icon>
  22. </view>
  23. <u-line-progress
  24. v-if="showProgress && item.progress > 0 && !item.error"
  25. :percent="item.progress"
  26. :show-percent="false"
  27. class="u-progress"
  28. height="16"
  29. ></u-line-progress>
  30. <view v-if="item.error" class="u-error-btn" @tap.stop="retry(index)">点击重试</view>
  31. <image v-if="!item.isImage" :mode="imageMode" :src="item.url || item.path"
  32. class="u-preview-image" @tap.stop="doPreviewImage(item.url || item.path, index)"></image>
  33. </view>
  34. <slot :file="lists" name="file"></slot>
  35. <view v-if="maxCount > lists.length" style="display: inline-block;" @tap="selectFile">
  36. <slot name="addBtn"></slot>
  37. <view
  38. v-if="!customBtn"
  39. :style="{
  40. width: $u.addUnit(width),
  41. height: $u.addUnit(height)
  42. }"
  43. class="u-list-item u-add-wrap"
  44. hover-class="u-add-wrap__hover"
  45. hover-stay-time="150"
  46. >
  47. <u-icon class="u-add-btn" name="plus" size="40"></u-icon>
  48. <view class="u-add-tips">{{ uploadText }}</view>
  49. </view>
  50. </view>
  51. </view>
  52. </template>
  53. <script>
  54. /**
  55. * upload 图片上传
  56. * @description 该组件用于上传图片场景
  57. * @tutorial https://www.uviewui.com/components/upload.html
  58. * @property {String} action 服务器上传地址
  59. * @property {String Number} max-count 最大选择图片的数量(默认99)
  60. * @property {Boolean} custom-btn 如果需要自定义选择图片的按钮,设置为true(默认false)
  61. * @property {Boolean} show-progress 是否显示进度条(默认true)
  62. * @property {Boolean} disabled 是否启用(显示/移仓)组件(默认false)
  63. * @property {String} image-mode 预览图片等显示模式,可选值为uni的image的mode属性值(默认aspectFill)
  64. * @property {String} del-icon 右上角删除图标名称,只能为uView内置图标
  65. * @property {String} del-bg-color 右上角关闭按钮的背景颜色
  66. * @property {String | Number} index 在各个回调事件中的最后一个参数返回,用于区别是哪一个组件的事件
  67. * @property {String} del-color 右上角关闭按钮图标的颜色
  68. * @property {Object} header 上传携带的头信息,对象形式
  69. * @property {Object} form-data 上传额外携带的参数
  70. * @property {String} name 上传文件的字段名,供后端获取使用(默认file)
  71. * @property {Array<String>} size-type original 原图,compressed 压缩图,默认二者都有(默认['original', 'compressed'])
  72. * @property {Array<String>} source-type 选择图片的来源,album-从相册选图,camera-使用相机,默认二者都有(默认['album', 'camera'])
  73. * @property {Boolean} preview-full-image 是否可以通过uni.previewImage预览已选择的图片(默认true)
  74. * @property {Boolean} multiple 是否开启图片多选,部分安卓机型不支持(默认true)
  75. * @property {Boolean} deletable 是否显示删除图片的按钮(默认true)
  76. * @property {String Number} max-size 选择单个文件的最大大小,单位B(byte),默认不限制(默认Number.MAX_VALUE)
  77. * @property {Array<Object>} file-list 默认显示的图片列表,数组元素为对象,必须提供url属性
  78. * @property {Boolean} upload-text 选择图片按钮的提示文字(默认“选择图片”)
  79. * @property {Boolean} auto-upload 选择完图片是否自动上传,见上方说明(默认true)
  80. * @property {Boolean} show-tips 特殊情况下是否自动提示toast,见上方说明(默认true)
  81. * @property {Boolean} show-upload-list 是否显示组件内部的图片预览(默认true)
  82. * @event {Function} on-oversize 图片大小超出最大允许大小
  83. * @event {Function} on-preview 全屏预览图片时触发
  84. * @event {Function} on-remove 移除图片时触发
  85. * @event {Function} on-success 图片上传成功时触发
  86. * @event {Function} on-change 图片上传后,无论成功或者失败都会触发
  87. * @event {Function} on-error 图片上传失败时触发
  88. * @event {Function} on-progress 图片上传过程中的进度变化过程触发
  89. * @event {Function} on-uploaded 所有图片上传完毕触发
  90. * @event {Function} on-choose-complete 每次选择图片后触发,只是让外部可以得知每次选择后,内部的文件列表
  91. * @example <u-upload :action="action" :file-list="fileList" ></u-upload>
  92. */
  93. export default {
  94. name: 'u-upload',
  95. props: {
  96. //是否显示组件自带的图片预览功能
  97. showUploadList: {
  98. type: Boolean,
  99. default: true
  100. },
  101. // 后端地址
  102. action: {
  103. type: String,
  104. default: ''
  105. },
  106. // 最大上传数量
  107. maxCount: {
  108. type: [String, Number],
  109. default: 52
  110. },
  111. // 是否显示进度条
  112. showProgress: {
  113. type: Boolean,
  114. default: true
  115. },
  116. // 是否启用
  117. disabled: {
  118. type: Boolean,
  119. default: false
  120. },
  121. // 预览上传的图片时的裁剪模式,和image组件mode属性一致
  122. imageMode: {
  123. type: String,
  124. default: 'aspectFill'
  125. },
  126. // 头部信息
  127. header: {
  128. type: Object,
  129. default() {
  130. return {};
  131. }
  132. },
  133. // 额外携带的参数
  134. formData: {
  135. type: Object,
  136. default() {
  137. return {};
  138. }
  139. },
  140. // 上传的文件字段名
  141. name: {
  142. type: String,
  143. default: 'file'
  144. },
  145. // 所选的图片的尺寸, 可选值为original compressed
  146. sizeType: {
  147. type: Array,
  148. default() {
  149. return ['original', 'compressed'];
  150. }
  151. },
  152. sourceType: {
  153. type: Array,
  154. default() {
  155. return ['album', 'camera'];
  156. }
  157. },
  158. // 是否在点击预览图后展示全屏图片预览
  159. previewFullImage: {
  160. type: Boolean,
  161. default: true
  162. },
  163. // 是否开启图片多选,部分安卓机型不支持
  164. multiple: {
  165. type: Boolean,
  166. default: true
  167. },
  168. // 是否展示删除按钮
  169. deletable: {
  170. type: Boolean,
  171. default: true
  172. },
  173. // 文件大小限制,单位为byte
  174. maxSize: {
  175. type: [String, Number],
  176. default: Number.MAX_VALUE
  177. },
  178. // 显示已上传的文件列表
  179. fileList: {
  180. type: Array,
  181. default() {
  182. return [];
  183. }
  184. },
  185. // 上传区域的提示文字
  186. uploadText: {
  187. type: String,
  188. default: '选择图片'
  189. },
  190. // 是否自动上传
  191. autoUpload: {
  192. type: Boolean,
  193. default: true
  194. },
  195. // 是否显示toast消息提示
  196. showTips: {
  197. type: Boolean,
  198. default: true
  199. },
  200. // 是否通过slot自定义传入选择图标的按钮
  201. customBtn: {
  202. type: Boolean,
  203. default: false
  204. },
  205. // 内部预览图片区域和选择图片按钮的区域宽度
  206. width: {
  207. type: [String, Number],
  208. default: 200
  209. },
  210. // 内部预览图片区域和选择图片按钮的区域高度
  211. height: {
  212. type: [String, Number],
  213. default: 200
  214. },
  215. // 右上角关闭按钮的背景颜色
  216. delBgColor: {
  217. type: String,
  218. default: '#fa3534'
  219. },
  220. // 右上角关闭按钮的叉号图标的颜色
  221. delColor: {
  222. type: String,
  223. default: '#ffffff'
  224. },
  225. // 右上角删除图标名称,只能为uView内置图标
  226. delIcon: {
  227. type: String,
  228. default: 'close'
  229. },
  230. // 如果上传后的返回值为json字符串,是否自动转json
  231. toJson: {
  232. type: Boolean,
  233. default: true
  234. },
  235. // 上传前的钩子,每个文件上传前都会执行
  236. beforeUpload: {
  237. type: Function,
  238. default: null
  239. },
  240. // 移除文件前的钩子
  241. beforeRemove: {
  242. type: Function,
  243. default: null
  244. },
  245. // 允许上传的图片后缀
  246. limitType: {
  247. type: Array,
  248. default() {
  249. // 支付宝小程序真机选择图片的后缀为"image"
  250. // https://opendocs.alipay.com/mini/api/media-image
  251. return ['png', 'jpg', 'jpeg', 'webp', 'gif', 'image'];
  252. }
  253. },
  254. // 在各个回调事件中的最后一个参数返回,用于区别是哪一个组件的事件
  255. index: {
  256. type: [Number, String],
  257. default: ''
  258. }
  259. },
  260. mounted() {
  261. },
  262. data() {
  263. return {
  264. lists: [],
  265. isInCount: true,
  266. uploading: false
  267. };
  268. },
  269. watch: {
  270. fileList: {
  271. immediate: true,
  272. handler(val) {
  273. val.map(value => {
  274. // 首先检查内部是否已经添加过这张图片,因为外部绑定了一个对象给fileList的话(对象引用),进行修改外部fileList
  275. // 时,会触发watch,导致重新把原来的图片再次添加到this.lists
  276. // 数组的some方法意思是,只要数组元素有任意一个元素条件符合,就返回true,而另一个数组的every方法的意思是数组所有元素都符合条件才返回true
  277. let tmp = this.lists.some(val => {
  278. return val.url == value.url;
  279. })
  280. // 如果内部没有这个图片(tmp为false),则添加到内部
  281. !tmp && this.lists.push({url: value.url, error: false, progress: 100});
  282. });
  283. }
  284. },
  285. // 监听lists的变化,发出事件
  286. lists(n) {
  287. this.$emit('on-list-change', n, this.index);
  288. }
  289. },
  290. methods: {
  291. // 清除列表
  292. clear() {
  293. this.lists = [];
  294. },
  295. // 重新上传队列中上传失败的所有文件
  296. reUpload() {
  297. this.uploadFile();
  298. },
  299. // 选择图片
  300. selectFile() {
  301. if (this.disabled) return;
  302. const {
  303. name = '',
  304. maxCount,
  305. multiple,
  306. maxSize,
  307. sizeType,
  308. lists,
  309. camera,
  310. compressed,
  311. maxDuration,
  312. sourceType
  313. } = this;
  314. let chooseFile = null;
  315. const newMaxCount = maxCount - lists.length;
  316. // 设置为只选择图片的时候使用 chooseImage 来实现
  317. chooseFile = new Promise((resolve, reject) => {
  318. uni.chooseImage({
  319. count: multiple ? (newMaxCount > 9 ? 9 : newMaxCount) : 1,
  320. sourceType: sourceType,
  321. sizeType,
  322. success: resolve,
  323. fail: reject
  324. });
  325. });
  326. chooseFile
  327. .then(res => {
  328. let file = null;
  329. let listOldLength = this.lists.length;
  330. res.tempFiles.map((val, index) => {
  331. // 检查文件后缀是否允许,如果不在this.limitType内,就会返回false
  332. if (!this.checkFileExt(val)) return;
  333. // 如果是非多选,index大于等于1或者超出最大限制数量时,不处理
  334. if (!multiple && index >= 1) return;
  335. if (val.size > maxSize) {
  336. this.$emit('on-oversize', val, this.lists, this.index);
  337. this.showToast('超出允许的文件大小');
  338. } else {
  339. if (maxCount <= lists.length) {
  340. this.$emit('on-exceed', val, this.lists, this.index);
  341. this.showToast('超出最大允许的文件个数');
  342. return;
  343. }
  344. lists.push({
  345. url: val.path,
  346. progress: 0,
  347. error: false,
  348. file: val
  349. });
  350. }
  351. });
  352. // 每次图片选择完,抛出一个事件,并将当前内部选择的图片数组抛出去
  353. this.$emit('on-choose-complete', this.lists, this.index);
  354. if (this.autoUpload) this.uploadFile(listOldLength);
  355. })
  356. .catch(error => {
  357. this.$emit('on-choose-fail', error);
  358. });
  359. },
  360. // 提示用户消息
  361. showToast(message, force = false) {
  362. if (this.showTips || force) {
  363. uni.showToast({
  364. title: message,
  365. icon: 'none'
  366. });
  367. }
  368. },
  369. // 该方法供用户通过ref调用,手动上传
  370. upload() {
  371. this.uploadFile();
  372. },
  373. // 对失败的图片重新上传
  374. retry(index) {
  375. this.lists[index].progress = 0;
  376. this.lists[index].error = false;
  377. this.lists[index].response = null;
  378. uni.showLoading({
  379. title: '重新上传'
  380. });
  381. this.uploadFile(index);
  382. },
  383. // 上传图片
  384. async uploadFile(index = 0) {
  385. if (this.disabled) return;
  386. if (this.uploading) return;
  387. // 全部上传完成
  388. if (index >= this.lists.length) {
  389. this.$emit('on-uploaded', this.lists, this.index);
  390. return;
  391. }
  392. // 检查是否是已上传或者正在上传中
  393. if (this.lists[index].progress == 100) {
  394. if (this.autoUpload == false) this.uploadFile(index + 1);
  395. return;
  396. }
  397. // 执行before-upload钩子
  398. if (this.beforeUpload && typeof (this.beforeUpload) === 'function') {
  399. // 执行回调,同时传入索引和文件列表当作参数
  400. // 在微信,支付宝等环境(H5正常),会导致父组件定义的customBack()函数体中的this变成子组件的this
  401. // 通过bind()方法,绑定父组件的this,让this.customBack()的this为父组件的上下文
  402. // 因为upload组件可能会被嵌套在其他组件内,比如u-form,这时this.$parent其实为u-form的this,
  403. // 非页面的this,所以这里需要往上历遍,一直寻找到最顶端的$parent,这里用了this.$u.$parent.call(this)
  404. // 明白意思即可,无需纠结this.$u.$parent.call(this)的细节
  405. let beforeResponse = this.beforeUpload.bind(this.$u.$parent.call(this))(index, this.lists);
  406. // 判断是否返回了promise
  407. if (!!beforeResponse && typeof beforeResponse.then === 'function') {
  408. await beforeResponse.then(res => {
  409. // promise返回成功,不进行动作,继续上传
  410. }).catch(err => {
  411. // 进入catch回调的话,继续下一张
  412. return this.uploadFile(index + 1);
  413. })
  414. } else if (beforeResponse === false) {
  415. // 如果返回false,继续下一张图片的上传
  416. return this.uploadFile(index + 1);
  417. } else {
  418. // 此处为返回"true"的情形,这里不写代码,就跳过此处,继续执行当前的上传逻辑
  419. }
  420. }
  421. // 检查上传地址
  422. if (!this.action) {
  423. this.showToast('请配置上传地址', true);
  424. return;
  425. }
  426. this.lists[index].error = false;
  427. this.uploading = true;
  428. // 创建上传对象
  429. let lifeData = uni.getStorageSync('lifeData');
  430. let token = lifeData.vuex_token
  431. const task = uni.uploadFile({
  432. url: this.action,
  433. filePath: this.lists[index].url,
  434. name: this.name,
  435. formData: this.formData,
  436. // header: this.header,
  437. header: {
  438. Authorization: token
  439. },
  440. success: res => {
  441. // 判断是否json字符串,将其转为json格式
  442. let data = this.toJson && this.$u.test.jsonString(res.data) ? JSON.parse(res.data) : res.data;
  443. if (data.code === 200) {
  444. // 上传成功
  445. this.lists[index].response = data;
  446. this.lists[index].progress = 100;
  447. this.lists[index].error = false;
  448. this.$emit('on-success', data, index, this.lists, this.index);
  449. } else {
  450. this.uploadError(index, data);
  451. }
  452. },
  453. fail: e => {
  454. this.uploadError(index, e);
  455. },
  456. complete: res => {
  457. uni.hideLoading();
  458. this.uploading = false;
  459. this.uploadFile(index + 1);
  460. this.$emit('on-change', res, index, this.lists, this.index);
  461. }
  462. });
  463. task.onProgressUpdate(res => {
  464. if (res.progress > 0) {
  465. this.lists[index].progress = res.progress;
  466. this.$emit('on-progress', res, index, this.lists, this.index);
  467. }
  468. });
  469. },
  470. // 上传失败
  471. uploadError(index, err) {
  472. this.lists[index].progress = 0;
  473. this.lists[index].error = true;
  474. this.lists[index].response = null;
  475. this.$emit('on-error', err, index, this.lists, this.index);
  476. // this.showToast('上传失败,请重试');
  477. uni.showModal({
  478. title: '认证失效,请重新登录',
  479. showCancel: false,
  480. success: (res) => {
  481. if (res.confirm) {
  482. // 没有token 则跳转到登录
  483. return uni.reLaunch({
  484. url: '../login/login'
  485. })
  486. }
  487. }
  488. });
  489. },
  490. // 删除一个图片
  491. deleteItem(index) {
  492. uni.showModal({
  493. title: '提示',
  494. content: '您确定要删除此项吗?',
  495. success: async (res) => {
  496. if (res.confirm) {
  497. // 先检查是否有定义before-remove移除前钩子
  498. // 执行before-remove钩子
  499. if (this.beforeRemove && typeof (this.beforeRemove) === 'function') {
  500. // 此处钩子执行 原理同before-remove参数,见上方注释
  501. let beforeResponse = this.beforeRemove.bind(this.$u.$parent.call(this))(index, this.lists);
  502. // 判断是否返回了promise
  503. if (!!beforeResponse && typeof beforeResponse.then === 'function') {
  504. await beforeResponse.then(res => {
  505. // promise返回成功,不进行动作,继续上传
  506. this.handlerDeleteItem(index);
  507. }).catch(err => {
  508. // 如果进入promise的reject,终止删除操作
  509. this.showToast('已终止移除');
  510. })
  511. } else if (beforeResponse === false) {
  512. // 返回false,终止删除
  513. this.showToast('已终止移除');
  514. } else {
  515. // 如果返回true,执行删除操作
  516. this.handlerDeleteItem(index);
  517. }
  518. } else {
  519. // 如果不存在before-remove钩子,
  520. this.handlerDeleteItem(index);
  521. }
  522. }
  523. }
  524. });
  525. },
  526. // 执行移除图片的动作,上方代码只是判断是否可以移除
  527. handlerDeleteItem(index) {
  528. // 如果文件正在上传中,终止上传任务,进度在0 < progress < 100则意味着正在上传
  529. if (this.lists[index].process < 100 && this.lists[index].process > 0) {
  530. typeof this.lists[index].uploadTask != 'undefined' && this.lists[index].uploadTask.abort();
  531. }
  532. this.lists.splice(index, 1);
  533. this.$forceUpdate();
  534. this.$emit('on-remove', index, this.lists, this.index);
  535. this.showToast('移除成功');
  536. },
  537. // 用户通过ref手动的形式,移除一张图片
  538. remove(index) {
  539. // 判断索引的合法范围
  540. if (index >= 0 && index < this.lists.length) {
  541. this.lists.splice(index, 1);
  542. this.$emit('on-list-change', this.lists, this.index);
  543. }
  544. },
  545. // 预览图片
  546. doPreviewImage(url, index) {
  547. if (!this.previewFullImage) return;
  548. const images = this.lists.map(item => item.url || item.path);
  549. uni.previewImage({
  550. urls: images,
  551. current: url,
  552. success: () => {
  553. this.$emit('on-preview', url, this.lists, this.index);
  554. },
  555. fail: () => {
  556. uni.showToast({
  557. title: '预览图片失败',
  558. icon: 'none'
  559. });
  560. }
  561. });
  562. },
  563. // 判断文件后缀是否允许
  564. checkFileExt(file) {
  565. // 检查是否在允许的后缀中
  566. let noArrowExt = false;
  567. // 获取后缀名
  568. let fileExt = '';
  569. const reg = /.+\./;
  570. // 如果是H5,需要从name中判断
  571. // #ifdef H5
  572. fileExt = file.name.replace(reg, "").toLowerCase();
  573. // #endif
  574. // 非H5,需要从path中读取后缀
  575. // #ifndef H5
  576. fileExt = file.path.replace(reg, "").toLowerCase();
  577. // #endif
  578. // 使用数组的some方法,只要符合limitType中的一个,就返回true
  579. noArrowExt = this.limitType.some(ext => {
  580. // 转为小写
  581. return ext.toLowerCase() === fileExt;
  582. })
  583. if (!noArrowExt) this.showToast(`不允许选择${fileExt}格式的文件`);
  584. return noArrowExt;
  585. }
  586. }
  587. };
  588. </script>
  589. <style lang="scss" scoped>
  590. @import '../../libs/css/style.components.scss';
  591. .u-upload {
  592. @include vue-flex;
  593. flex-wrap: wrap;
  594. align-items: center;
  595. }
  596. .u-list-item {
  597. width: 200 rpx;
  598. height: 200 rpx;
  599. overflow: hidden;
  600. margin: 10 rpx;
  601. background: rgb(244, 245, 246);
  602. position: relative;
  603. border-radius: 10 rpx;
  604. /* #ifndef APP-NVUE */
  605. display: flex;
  606. /* #endif */
  607. align-items: center;
  608. justify-content: center;
  609. }
  610. .u-preview-wrap {
  611. border: 1px solid rgb(235, 236, 238);
  612. }
  613. .u-add-wrap {
  614. flex-direction: column;
  615. color: $u-content-color;
  616. font-size: 26 rpx;
  617. }
  618. .u-add-tips {
  619. margin-top: 20 rpx;
  620. line-height: 40 rpx;
  621. }
  622. .u-add-wrap__hover {
  623. background-color: rgb(235, 236, 238);
  624. }
  625. .u-preview-image {
  626. display: block;
  627. width: 100%;
  628. height: 100%;
  629. border-radius: 10 rpx;
  630. }
  631. .u-delete-icon {
  632. position: absolute;
  633. top: 10 rpx;
  634. right: 10 rpx;
  635. z-index: 10;
  636. background-color: $u-type-error;
  637. border-radius: 100 rpx;
  638. width: 44 rpx;
  639. height: 44 rpx;
  640. @include vue-flex;
  641. align-items: center;
  642. justify-content: center;
  643. }
  644. .u-icon {
  645. @include vue-flex;
  646. align-items: center;
  647. justify-content: center;
  648. }
  649. .u-progress {
  650. position: absolute;
  651. bottom: 10 rpx;
  652. left: 8 rpx;
  653. right: 8 rpx;
  654. z-index: 9;
  655. width: auto;
  656. }
  657. .u-error-btn {
  658. color: #ffffff;
  659. background-color: $u-type-error;
  660. font-size: 20 rpx;
  661. padding: 4px 0;
  662. text-align: center;
  663. position: absolute;
  664. bottom: 0;
  665. left: 0;
  666. right: 0;
  667. z-index: 9;
  668. line-height: 1;
  669. }
  670. </style>