Browse Source

ie兼容处理

yangc 7 years ago
parent
commit
826587ff3d

+ 7 - 0
.babelrc

@@ -0,0 +1,7 @@
+{
+  "presets": [
+    "es2015",
+    "stage-2"
+  ],
+  "plugins": []
+}

+ 0 - 1
components/default/RightBar.vue

@@ -56,7 +56,6 @@
       },
       // 打开留言板
       onLeaveMessageClick () {
-
       }
     }
   }

+ 7 - 0
components/main/Search.vue

@@ -83,12 +83,15 @@
     },
     methods: {
       onFocus () {
+        console.log('focus')
         this.associate.show = true
       },
       onBlur () {
+        console.log('blur')
         this.associate.show = this.associate.focus
       },
       onSelectChange (count) {
+        console.log('selectchange')
         let keywords = this.similarKeywords.data
         if (keywords && keywords.length) {
           let index = this.associate.activeIndex
@@ -106,6 +109,7 @@
         }
       },
       onChange () {
+        console.log('change')
         this.associate.activeIndex = null
         if (!this.keyword) {
           this.associate.show = false
@@ -119,10 +123,12 @@
         }
       },
       searchKeywords () {
+        console.log('searchkeywords')
         this.associate.show = true
         this.$store.dispatch('searchKeywords', { keyword: this.keyword })
       },
       onSearch () {
+        console.log('search')
         if (this.keyword) {
           this.associate.show = false
           this.$store.dispatch('resetSearchKeywords')
@@ -130,6 +136,7 @@
         }
       },
       onAssociateClick (word) {
+        console.log('assclick')
         this.click_flag = true
         this.keyword = word
         this.onSearch()

+ 5 - 4
components/news/Detail.vue

@@ -26,10 +26,11 @@
       date: function (input) {
         const d = new Date(input)
         const year = d.getFullYear()
-        const month = d.getMonth() + 1
-        const hour = d.getHours()
-        const minutes = d.getMinutes()
-        const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' ' + hour + ':' + minutes
+        const monthTemp = d.getMonth() + 1
+        const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
+        const hour = d.getHours() < 10 ? '0' + d.getHours() : '' + d.getHours() + ' '
+        const minutes = d.getMinutes() < 10 ? '0' + d.getMinutes() : '' + d.getMinutes() + ' '
+        const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
         return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
       }
     }

+ 2 - 1
components/news/Left.vue

@@ -39,7 +39,8 @@
       date: function (input) {
         const d = new Date(input)
         const year = d.getFullYear()
-        const month = d.getMonth() + 1
+        const monthTemp = d.getMonth() + 1
+        const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
         const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
         return year + '-' + month + '-' + day
       }

+ 5 - 4
components/news/Right.vue

@@ -52,10 +52,11 @@
       date: function (input) {
         const d = new Date(input)
         const year = d.getFullYear()
-        const month = d.getMonth() + 1
-        const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate()
-        const hour = d.getHours()
-        const minutes = d.getMinutes()
+        const monthTemp = d.getMonth() + 1
+        const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
+        const hour = d.getHours() < 10 ? '0' + d.getHours() : '' + d.getHours() + ' '
+        const minutes = d.getMinutes() < 10 ? '0' + d.getMinutes() : '' + d.getMinutes() + ' '
+        const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
         return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
       }
     },

+ 1 - 1
components/search/GoodList.vue

@@ -66,7 +66,7 @@
               </nuxt-link></div>
             </td>
             <td>
-              <div class="package" v-text="item.packing?item.packing:'暂无包装方式信息'"></div>
+              <div class="package" v-text="item.packaging?item.packaging:'暂无包装方式信息'"></div>
               <div class="date" v-text="item.produceDate"></div>
             </td>
             <td>

+ 1 - 1
components/search/Kind.vue

@@ -30,7 +30,7 @@
         </a>
       </div>
     </div>
-    <div class="sl-wrap" v-if="good_list.total > 0 && !list_data_brands">
+    <div class="sl-wrap" v-if="good_list.total > 0 &&( !list_data_brands || !list_data_brands.uuid )">
       <div class="sl-key f14">品牌:</div>
       <div class="sl-value" >
          <span v-for="(brand_temp, index) in brand_exp_arr" >

+ 7 - 0
nuxt.config.js

@@ -38,6 +38,10 @@ module.exports = {
         test: /\.scss$/,
         loader: 'vue-style-loader!css-loader!sass-loader'
       })
+      config.module.rules.push({
+        test: /\.js$/,
+        loader: 'babel-loader'
+      })
       if (isClient) {
         config.module.rules.push({
           enforce: 'pre',
@@ -98,6 +102,9 @@ module.exports = {
   }, {
     src: '~plugins/filters.js',
     ssr: false
+  }, {
+    src: '~plugins/babel-polyfill.js',
+    ssr: false
   }],
   proxyTable: ['/api/**', '/search/**', '/user/**', '/login/**', '/logout/**']
 }

+ 5 - 0
package.json

@@ -31,7 +31,12 @@
     "precommit": "npm run lint"
   },
   "devDependencies": {
+    "babel-cli": "^6.24.1",
+    "babel-core": "^6.25.0",
     "babel-eslint": "^7.1.1",
+    "babel-loader": "^7.1.1",
+    "babel-plugin-transform-runtime": "^6.23.0",
+    "babel-preset-es2015": "^6.24.1",
     "babel-preset-stage-2": "^6.24.1",
     "eslint": "^3.15.0",
     "eslint-config-standard": "^6.2.1",

+ 1 - 1
pages/product/component/_uuid.vue

@@ -17,7 +17,7 @@
     fetch ({ store, route }) {
       return Promise.all([
         store.dispatch('loadComponentDetail', {id: route.params.uuid}),
-        store.dispatch('loadComponentStore', {id: route.params.uuid}),
+        store.dispatch('loadComponentStore', {uuid: route.params.uuid}),
         store.dispatch('loadComponentInformation', {uuid: route.params.uuid})
       ])
     },

+ 4 - 0
plugins/babel-polyfill.js

@@ -0,0 +1,4 @@
+import Vue from 'vue'
+import babelPolyfill from 'babel-polyfill'
+
+Vue.use(babelPolyfill)