index.vue 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <template>
  2. <view class="content">
  3. <view class="icon-wrap" >
  4. <view class="item" v-for="(item,index) in items" :key="index" @click="check(item)">
  5. <text class="zhcx-iconfont" :class="item"></text>
  6. <text class="name">{{item}}</text>
  7. </view>
  8. </view>
  9. </view>
  10. </template>
  11. <script>
  12. import items from './data.js';
  13. export default{
  14. name:'zhcx-icon',
  15. data(){
  16. return{
  17. items,
  18. iconTxt:"",
  19. star:3.6
  20. }
  21. },
  22. methods:{
  23. check(value){
  24. uni.showModal({
  25. title:"温馨提示!",
  26. content:"复制图标的类名",
  27. confirmText:'直接复制',
  28. cancelColor:"orange",
  29. cancelText:"去看源码",
  30. success:()=>{
  31. uni.setClipboardData({
  32. data:value,
  33. success:()=>{
  34. uni.showToast({
  35. title:'复制成功'
  36. })
  37. }
  38. });
  39. },
  40. fail(res){
  41. uni.showToast({
  42. title:'复制失败'
  43. })
  44. }
  45. });
  46. }
  47. }
  48. }
  49. </script>
  50. <style lang="scss" scoped>
  51. .content{
  52. padding-bottom: 20upx;
  53. padding-top: 30upx;
  54. .icon-wrap{
  55. width: 100%;
  56. display: flex;
  57. justify-content: center;
  58. flex-wrap: wrap;
  59. border-right: 1px solid #ccc;
  60. border-top: 1px solid #ccc;
  61. box-sizing: border-box;
  62. margin-top:20upx;
  63. .item{
  64. width: 33.33%;
  65. height: 200upx;
  66. box-sizing: border-box;
  67. display: flex;
  68. justify-content: space-between;
  69. align-items: center;
  70. flex-direction: column;
  71. border-left: 1px solid #ccc;
  72. border-bottom: 1px solid #ccc;
  73. .zhcx-iconfont{
  74. font-size: 65upx;
  75. text-align: center;
  76. margin-top: 50upx;
  77. color: #666;
  78. }
  79. .name{
  80. width: 80%;
  81. font-size: 24upx;
  82. white-space: nowrap;
  83. overflow: hidden;
  84. text-overflow: ellipsis;
  85. padding-bottom: 15upx;
  86. text-align: center;
  87. }
  88. }
  89. }
  90. }
  91. </style>