logo

pleroma-fe

My custom branche(s) on git.pleroma.social/pleroma/pleroma-fe git clone https://hacktivis.me/git/pleroma-fe.git

size_setting.js (967B)


  1. import Select from 'src/components/select/select.vue'
  2. import Setting from './setting.js'
  3. export const allCssUnits = ['cm', 'mm', 'in', 'px', 'pt', 'pc', 'em', 'ex', 'ch', 'rem', 'vw', 'vh', 'vmin', 'vmax', '%']
  4. export const defaultHorizontalUnits = ['px', 'rem', 'vw']
  5. export const defaultVerticalUnits = ['px', 'rem', 'vh']
  6. export default {
  7. ...Setting,
  8. components: {
  9. ...Setting.components,
  10. Select
  11. },
  12. props: {
  13. ...Setting.props,
  14. min: Number,
  15. units: {
  16. type: Array,
  17. default: () => allCssUnits
  18. }
  19. },
  20. computed: {
  21. ...Setting.computed,
  22. stateUnit () {
  23. return this.state.replace(/\d+/, '')
  24. },
  25. stateValue () {
  26. return this.state.replace(/\D+/, '')
  27. }
  28. },
  29. methods: {
  30. ...Setting.methods,
  31. updateValue (e) {
  32. this.configSink(this.path, parseInt(e.target.value) + this.stateUnit)
  33. },
  34. updateUnit (e) {
  35. this.configSink(this.path, this.stateValue + e.target.value)
  36. }
  37. }
  38. }