项目原始demo,不改动
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.
To repozytorium jest zarchiwizowane. Możesz wyświetlać pliki i je sklonować, ale nie możesz do niego przepychać zmian lub otwierać zgłoszeń/Pull Requestów.
 
 
 
 

47 wiersze
832 B

  1. import Vue from 'vue';
  2. export function factory(prop = 'value', event = 'change') {
  3. return Vue.extend({
  4. name: 'proxyable',
  5. model: {
  6. prop,
  7. event
  8. },
  9. props: {
  10. [prop]: {
  11. required: false
  12. }
  13. },
  14. data() {
  15. return {
  16. internalLazyValue: this[prop]
  17. };
  18. },
  19. computed: {
  20. internalValue: {
  21. get() {
  22. return this.internalLazyValue;
  23. },
  24. set(val) {
  25. if (val === this.internalLazyValue) return;
  26. this.internalLazyValue = val;
  27. this.$emit(event, val);
  28. }
  29. }
  30. },
  31. watch: {
  32. [prop](val) {
  33. this.internalLazyValue = val;
  34. }
  35. }
  36. });
  37. }
  38. /* eslint-disable-next-line no-redeclare */
  39. const Proxyable = factory();
  40. export default Proxyable;
  41. //# sourceMappingURL=index.js.map