在线打印
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.

6 mesi fa
123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <template>
  2. <kr-print-designer ref="printDesigner" :temp-value="value" :widget-options="widgets" @save="handleSave" />
  3. </template>
  4. <script>
  5. import { OutStockOptions, InStockOptions } from '../data/options'
  6. export default {
  7. data() {
  8. return {
  9. index: '',
  10. value: {
  11. title: 'demo',
  12. width: 750,
  13. height: 550,
  14. pageWidth: 750,
  15. pageHeight: 550,
  16. tempItems: [],
  17. },
  18. widgets: OutStockOptions,
  19. }
  20. },
  21. created() {
  22. this.index = this.$route.query.index
  23. try {
  24. let tempList = JSON.parse(localStorage.getItem('tempList')) || []
  25. this.value = tempList[this.index]
  26. this.widgets = this.value.type == 1 ? OutStockOptions : InStockOptions
  27. } catch (err) {
  28. console.error(err)
  29. }
  30. },
  31. methods: {
  32. handleSave(data) {
  33. let tempList = JSON.parse(localStorage.getItem('tempList')) || []
  34. tempList[this.index] = data
  35. localStorage.setItem('tempList', JSON.stringify(tempList))
  36. this.$router.back()
  37. },
  38. // 手动初始话模板数据
  39. initTemp(){
  40. this.$refs.printDesigner.initTemp(this.value,this.widgets)
  41. }
  42. },
  43. }
  44. </script>