| 
									
										
										
										
											2021-08-19 14:40:59 +08:00
										 |  |  | <template> | 
					
						
							|  |  |  | 	<view> | 
					
						
							|  |  |  | 		<scroll-view scroll-x > | 
					
						
							|  |  |  | 			<view class="" :class="isCenter?'disac':'disjb'"> | 
					
						
							| 
									
										
										
										
											2022-01-24 13:53:00 +08:00
										 |  |  | 				<view @tap="choosecate(index)" v-if="item.title!='仿真设计'" | 
					
						
							| 
									
										
										
										
											2021-08-19 14:40:59 +08:00
										 |  |  | 					:style="{ | 
					
						
							|  |  |  | 						background : newCurrent==index ? activeb:newbmo, | 
					
						
							|  |  |  | 						fontSize:newfmo+'px', | 
					
						
							|  |  |  | 						borderRadius:newRadius+'px', | 
					
						
							|  |  |  | 						minWidth:isMinW ? newMinWidth+'px':'', | 
					
						
							|  |  |  | 						color : newCurrent==index ? activec:newcmo}"  | 
					
						
							|  |  |  | 					class="flexs cateitem" :class="(!isCenter && newcateList.length<=4)?'maright0':''" | 
					
						
							|  |  |  | 					v-for="(item,index) in newcateList" :key="index">{{item.title}}</view> | 
					
						
							|  |  |  | 			</view> | 
					
						
							|  |  |  | 		</scroll-view> | 
					
						
							|  |  |  | 	</view> | 
					
						
							|  |  |  | </template> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <script> | 
					
						
							|  |  |  | 	export default { | 
					
						
							|  |  |  | 		name:"cate-pu", | 
					
						
							|  |  |  | 		props:{ | 
					
						
							|  |  |  | 			isCenter:{ | 
					
						
							|  |  |  | 				type:Boolean, | 
					
						
							|  |  |  | 				default:true | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			activeb:{//选中背景色
 | 
					
						
							|  |  |  | 				type:String, | 
					
						
							|  |  |  | 				default:'#3875F6' | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			activec:{//选中字体颜色
 | 
					
						
							|  |  |  | 				type:String, | 
					
						
							|  |  |  | 				default:'#FFFFFF' | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			newcateList:{//分类列表
 | 
					
						
							|  |  |  | 				type:Array, | 
					
						
							|  |  |  | 				default:function(){ | 
					
						
							|  |  |  | 					return [ | 
					
						
							|  |  |  | 						{title:'热门问题'}, | 
					
						
							|  |  |  | 						{title:'病种'}, | 
					
						
							|  |  |  | 						{title:'案例日记'}, | 
					
						
							|  |  |  | 						{title:'效果模拟'}, | 
					
						
							|  |  |  | 						{title:'效果模拟'}, | 
					
						
							|  |  |  | 					] | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			newbmo:{//默认背景色
 | 
					
						
							|  |  |  | 				type:String, | 
					
						
							|  |  |  | 				default:'#FFFFFF' | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			newcmo:{//默认字体颜色
 | 
					
						
							|  |  |  | 				type:String, | 
					
						
							|  |  |  | 				default:'#333333' | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			newfmo:{//默认字体大小
 | 
					
						
							|  |  |  | 				type:String, | 
					
						
							| 
									
										
										
										
											2021-08-26 17:57:04 +08:00
										 |  |  | 				default:'15' | 
					
						
							| 
									
										
										
										
											2021-08-19 14:40:59 +08:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			newRadius:{//圆角
 | 
					
						
							|  |  |  | 				type:String, | 
					
						
							|  |  |  | 				default:'10' | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			isMinW:{//是否使用最小宽度
 | 
					
						
							|  |  |  | 				type:Boolean, | 
					
						
							|  |  |  | 				default:false | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 			newMinWidth:{//最小宽度
 | 
					
						
							|  |  |  | 				type:String, | 
					
						
							| 
									
										
										
										
											2021-08-26 17:57:04 +08:00
										 |  |  | 				default:'52'//49
 | 
					
						
							| 
									
										
										
										
											2021-08-19 14:40:59 +08:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 			newCurrent:{//默认选中
 | 
					
						
							|  |  |  | 				type:Number, | 
					
						
							|  |  |  | 				default:0 | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		data() { | 
					
						
							|  |  |  | 			return { | 
					
						
							|  |  |  | 				current:0, | 
					
						
							|  |  |  | 			}; | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		methods:{ | 
					
						
							|  |  |  | 			choosecate(index){//二级分类选择
 | 
					
						
							|  |  |  | 				// console.log('二级分类:',index);
 | 
					
						
							|  |  |  | 				this.$emit('choosecateEv',index) | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | </script> | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | <style scoped> | 
					
						
							|  |  |  | .catetwomo{background-color: #FFFFFF;color: #4D4D4D;} | 
					
						
							|  |  |  | .disac{display: flex;align-items: center;} | 
					
						
							|  |  |  | .flexs{flex-shrink: 0;} | 
					
						
							| 
									
										
										
										
											2021-08-26 17:57:04 +08:00
										 |  |  | .cateitem{padding: 16rpx 20rpx;text-align: center;margin-right: 20rpx;} | 
					
						
							| 
									
										
										
										
											2021-08-19 14:40:59 +08:00
										 |  |  | .maright0{margin-right: 0!important;} | 
					
						
							|  |  |  | </style> |