permissionsSlot.vue 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <!--
  2. <permissionsSlot class="button-for-box" :hasPermi="'demo:demo:demo'">
  3. </permissionsSlot>
  4. -->
  5. <template>
  6. <view class="permissionsSlot" v-if='permissionType'>
  7. <slot></slot>
  8. </view>
  9. </template>
  10. <script>
  11. export default {
  12. name: "permissionsSlot",
  13. props: {
  14. hasPermi: '',
  15. },
  16. data() {
  17. return {
  18. permissionType: false,
  19. objStore: uni.getStorageSync('permissions'),
  20. }
  21. },
  22. created() {
  23. },
  24. mounted() {
  25. this.permissionVerification();
  26. },
  27. methods: {
  28. permissionVerification() {
  29. let self = this;
  30. // console.log('self.objStore',self.objStore)
  31. // console.log('self.hasPermi',self.hasPermi)
  32. if (this.objStore[0] == "*:*:*" || self.hasPermi === "") {
  33. this.$set(self, 'permissionType', true);
  34. return
  35. }
  36. for (let i = 0; i < self.objStore.length; i++) {
  37. if (self.objStore[i] === self.hasPermi) {
  38. this.$set(self, 'permissionType', true);
  39. return
  40. }
  41. }
  42. },
  43. },
  44. }
  45. </script>
  46. <style lang="stylus" scoped>
  47. .permissionsSlot {
  48. margin: 0;
  49. padding: 0;
  50. }
  51. </style>