lybenson 8 роки тому
батько
коміт
18e74dd69e
2 змінених файлів з 26 додано та 12 видалено
  1. 4 11
      src/components/content/BContent.vue
  2. 22 1
      src/components/nav/BNavSide.vue

+ 4 - 11
src/components/content/BContent.vue

@@ -19,11 +19,9 @@
 			<BLive></BLive>
 		</div>
 		<!-- 各分类具体内容 -->
-		<div class="container-row"  v-for="(row, index) in rows" :id="getContentRowId(index)">
+		<div class="container-row"  v-for="(row, index) in rows">
 		
 			<BContentRow :category="sortKeys[index]" :categoryId="sortIds[index]" :row="row"></BContentRow>
-		}
-		}
 		</div>
 	</div>
 </template>
@@ -37,11 +35,6 @@ import BContentRow from 'components/contentRow/BContentRow'
 
 import { mapGetters } from 'vuex'
 export default {
-	data() {
-		return {
-			list: [0,1,1]
-		}
-	},
 	computed: {
 		...mapGetters([
 			'requesting',
@@ -57,9 +50,9 @@ export default {
 		console.log(JSON.stringify(this.items[0].name) + '=======')
 	},
 	methods: {
-		getContentRowId(index) {
-			return `b_${this.items[index].id}`
-		}
+		// getContentRowId(index) {
+		// 	return `b_${this.items[index].id}`
+		// }
 	},
 	components: {
 		Banner,

+ 22 - 1
src/components/nav/BNavSide.vue

@@ -36,6 +36,7 @@
 
 <script>
 import scrollMixin from './smooth-scroll.js'
+import { mapGetters } from 'vuex'
 export default {
 	mixins: [scrollMixin],
 	data() {
@@ -54,6 +55,15 @@ export default {
 			y: 0  //被拖拽的元素在其相对的元素上的Y坐标上的偏移
 		}
 	},
+	computed: {
+		...mapGetters([
+			'requesting',
+			'error',
+			'rows',
+			'sortKeys',
+			'sortIds'
+		])
+	},
 	props: {
 		options: {
 			type: Object
@@ -66,6 +76,13 @@ export default {
 			handler(newVal, oldVal) {
 				this.initData()
 			}
+		},
+		rows() {
+			console.log(this.sortKeys + 'xxx')
+			if (this.rows) {
+				console.log(this.rows + '----rows存在')
+				this.initData()
+			}
 		}
 	},
 	computed: {
@@ -73,7 +90,7 @@ export default {
 		offset() {
 			return this.options.offset || 100
 		},
-		// 拖拽的元素的position会变为absolute,dragStyles用来设置其位置,鼠标运动时会调用,从而实现跟随鼠标运动的功能
+		// 拖拽的元素的position会变为absolute,dragStyles用来设置其位置,鼠标运动时会调用,从而实现跟随鼠标运动
 		dragStyles() { 
 			return {
 				left: `${this.x}px`,
@@ -91,6 +108,10 @@ export default {
 		}
 	},
 	mounted() {
+		console.log('0000'+this.sortIds)
+		if (!this.rows) {
+			return
+		}
 		this.init()
 	},
 	methods: {