mixin.vue 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <style>
  2. .config {
  3. padding: 5px 0;
  4. }
  5. .config-label {
  6. color: #606266;;
  7. font-size: 14px;
  8. padding-bottom: 5px;
  9. position: relative;
  10. }
  11. .config-content {
  12. }
  13. .content-80 {
  14. box-sizing: border-box;
  15. display: inline-block;
  16. width: 80%;
  17. }
  18. .content-20 {
  19. box-sizing: border-box;
  20. display: inline-block;
  21. width: 20%;
  22. vertical-align: bottom;
  23. }
  24. .content-10 {
  25. box-sizing: border-box;
  26. display: inline-block;
  27. width: 10%;
  28. vertical-align: bottom;
  29. }
  30. .content-15 {
  31. box-sizing: border-box;
  32. display: inline-block;
  33. width: 15%;
  34. vertical-align: bottom;
  35. }
  36. </style>
  37. <script>
  38. import { getStyleDisplayName } from '../utils/utils.js';
  39. export default {
  40. props: {
  41. config: {
  42. type: Object
  43. },
  44. userConfig: {
  45. type: Object
  46. },
  47. golbalValue: {
  48. type: Object
  49. },
  50. componentName: {
  51. type: String
  52. }
  53. },
  54. computed: {
  55. mergedValue() {
  56. return this.userConfig[this.config.key] || this.config.value;
  57. },
  58. displayName() {
  59. return getStyleDisplayName(this.config, this.componentName);
  60. },
  61. isGlobal() {
  62. return !this.config.value.startsWith('$');
  63. }
  64. },
  65. methods: {
  66. onChange(value) {
  67. this.$emit('onChange', {
  68. key: this.config.key,
  69. value
  70. });
  71. }
  72. }
  73. };
  74. </script>