拿到props 中的值 加监听器

75 阅读1分钟

	export default ({
		
		props: {
			items: {
				type: Array,
				default: function() {
					return [];
				}
			},
		},
		data(){
			return {
				data:this.items
			}
		},
		mounted() {
			console.log('子组件推荐课程:',this.items)
			
			
			
		},
		watch:{
			"items":function(val){
				console.log(val)
			}
		}
	})