执行过npm install命令的vue-element-admin源码
康凯
2022-05-20 aa4c235a8ca67ea8b731f90c951a465e92c0a865
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
"use strict";
 
const HTMLElementImpl = require("./HTMLElement-impl").implementation;
const { getLabelsForLabelable } = require("../helpers/form-controls");
const { parseFloatingPointNumber } = require("../helpers/strings");
 
class HTMLProgressElementImpl extends HTMLElementImpl {
  constructor(args, privateData) {
    super(args, privateData);
    this._labels = null;
  }
 
  get value() {
    const parsedValue = parseFloatingPointNumber(this.getAttributeNS(null, "value"));
 
    if (!isNaN(parsedValue) && parsedValue > 0) {
      return parsedValue > this.max ? this.max : parsedValue;
    }
 
    return 0;
  }
  set value(value) {
    this.setAttributeNS(null, "value", value);
  }
 
  get max() {
    const parsedMax = parseFloatingPointNumber(this.getAttributeNS(null, "max"));
 
    if (!isNaN(parsedMax) && parsedMax > 0) {
      return parsedMax;
    }
 
    return 1.0;
  }
  set max(value) {
    this.setAttributeNS(null, "max", value);
  }
 
  get position() {
    if (!this.hasAttributeNS(null, "value")) {
      return -1;
    }
 
    return this.value / this.max;
  }
 
  get labels() {
    return getLabelsForLabelable(this);
  }
}
 
module.exports = {
  implementation: HTMLProgressElementImpl
};