com-header.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <style>
  2. </style>
  3. <template id="com-header">
  4. <div class="com-header" flex="dir:left box:first cross:center">
  5. <span><slot></slot></span>
  6. <div flex="dir:right">
  7. <div>
  8. <input name="_csrf" type="hidden" id="_csrf" value="<?= Yii::$app->request->csrfToken ?>">
  9. <input name="flag" type="hidden" value="EXPORT">
  10. <input v-for="(item,index) in search"
  11. :name="index"
  12. type="hidden"
  13. :value="item">
  14. <slot name="other"></slot>
  15. </div>
  16. <button @click="exportData()" class="el-button el-button--primary el-button--small">导出全部</button>
  17. </div>
  18. </div>
  19. </template>
  20. <script>
  21. Vue.component('com-header', {
  22. template: '#com-header',
  23. props: {
  24. url: {
  25. type: String,
  26. default: ''
  27. },
  28. newSearch: {
  29. type: String,
  30. default: '',
  31. }
  32. },
  33. watch: {
  34. newSearch: function (newVal) {
  35. let self = this;
  36. let newSearch = JSON.parse(newVal);
  37. self.search = newSearch;
  38. }
  39. },
  40. data() {
  41. return {
  42. search: [],
  43. }
  44. },
  45. methods: {
  46. exportData() {
  47. this.$emit('export-data');
  48. }
  49. }
  50. })
  51. </script>