css-variable.js 675 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /**
  2. * CSS 变量
  3. */
  4. const props = {
  5. // 重要的
  6. prominent: {
  7. type: String,
  8. default: "#C8C8C8"
  9. },
  10. // 常规的
  11. general: {
  12. type: String,
  13. default: "#E0E0E0"
  14. },
  15. // 次要的
  16. minor: {
  17. type: String,
  18. default: "#F2F2F2"
  19. },
  20. // 背景
  21. background: {
  22. type: String,
  23. default: "#FFFFFF"
  24. }
  25. }
  26. const computed = {
  27. mixinVariableStr() {
  28. let keys = ['prominent', 'general', 'minor', 'background'];
  29. if(this.privateVariableKeys && this.privateVariableKeys.length > 0){
  30. keys = keys.concat(this.privateVariableKeys);
  31. }
  32. let str = keys.map(item => {
  33. return `--${item}:${this[item]}`
  34. }).join(";");
  35. return str;
  36. }
  37. }
  38. export default {
  39. props,
  40. computed
  41. }