金诚优选前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
733 B

  1. <template>
  2. <view id="brand-index">
  3. </view>
  4. </template>
  5. <script>
  6. export default {
  7. data() {
  8. return {};
  9. },
  10. components: {},
  11. props: {},
  12. methods: {
  13. setData: function (obj) {
  14. let that = this;
  15. let keys = [];
  16. let val, data;
  17. Object.keys(obj).forEach(function (key) {
  18. keys = key.split('.');
  19. val = obj[key];
  20. data = that.$data;
  21. keys.forEach(function (key2, index) {
  22. if (index + 1 == keys.length) {
  23. that.$set(data, key2, val);
  24. } else {
  25. if (!data[key2]) {
  26. that.$set(data, key2, {});
  27. }
  28. }
  29. data = data[key2];
  30. });
  31. });
  32. }
  33. },
  34. computed: {},
  35. watch: {}
  36. };
  37. </script>