permissionsSlot.vue 848 B

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