App.vue 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <div>
  3. <v-header :seller="seller"></v-header>
  4. <div class="tab border-1px">
  5. <div class="tab-item">
  6. <router-link to="/goods">商品</router-link>
  7. </div>
  8. <div class="tab-item">
  9. <router-link to="/ratings">评论</router-link>
  10. </div>
  11. <div class="tab-item">
  12. <router-link to="/seller">商家</router-link>
  13. </div>
  14. </div>
  15. <keep-alive>
  16. <router-view :seller="seller"></router-view>
  17. </keep-alive>
  18. </div>
  19. </template>
  20. <script type="text/ecmascript-6">
  21. import { urlParse } from 'common/js/util';
  22. import header from 'components/header/header.vue';
  23. const ERR_OK = 0;
  24. const debug = process.env.NODE_ENV !== 'production';
  25. export default {
  26. data() {
  27. return {
  28. seller: {
  29. id: (() => {
  30. let queryParam = urlParse();
  31. return queryParam.id;
  32. })()
  33. }
  34. };
  35. },
  36. created() {
  37. const url = debug ? '/api/seller' : 'http://ustbhuangyi.com/sell/api/seller';
  38. this.$http.get(url + '?id=' + this.seller.id).then((response) => {
  39. response = response.body;
  40. if (response.errno === ERR_OK) {
  41. this.seller = Object.assign({}, this.seller, response.data);
  42. }
  43. });
  44. },
  45. components: {
  46. 'v-header': header
  47. }
  48. };
  49. </script>
  50. <style lang="stylus" rel="stylesheet/stylus">
  51. @import "./common/stylus/mixin.styl"
  52. .tab
  53. display: flex
  54. width: 100%
  55. height: 40px
  56. line-height: 40px
  57. border-1px(rgba(7, 17, 27, 0.1))
  58. //border-bottom: 1px solid rgba(7, 17, 27, 0.1)
  59. .tab-item
  60. flex: 1
  61. text-align: center
  62. & > a
  63. display: block
  64. font-size: 14px
  65. color: rgb(77, 85, 93)
  66. &.active
  67. color: rgb(240, 20, 20)
  68. </style>