mirror of https://github.com/vuejs/core.git
				
				
				
			wip: function slot tips
This commit is contained in:
		
							parent
							
								
									0cd8e16366
								
							
						
					
					
						commit
						d5684e1a9d
					
				| 
						 | 
					@ -47,8 +47,10 @@ export function resolveSlots(
 | 
				
			||||||
          ;(slots as any)[key] = normalizeSlot(key, value)
 | 
					          ;(slots as any)[key] = normalizeSlot(key, value)
 | 
				
			||||||
        } else {
 | 
					        } else {
 | 
				
			||||||
          if (__DEV__) {
 | 
					          if (__DEV__) {
 | 
				
			||||||
            // TODO show tip on using functions
 | 
					            warn(
 | 
				
			||||||
            console.log('use function slots!')
 | 
					              `Non-function value encountered for slot "${key}". ` +
 | 
				
			||||||
 | 
					                `Prefer function slots for better performance.`
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
          value = normalizeSlotValue(value)
 | 
					          value = normalizeSlotValue(value)
 | 
				
			||||||
          ;(slots as any)[key] = () => value
 | 
					          ;(slots as any)[key] = () => value
 | 
				
			||||||
| 
						 | 
					@ -58,8 +60,10 @@ export function resolveSlots(
 | 
				
			||||||
  } else if (children !== null) {
 | 
					  } else if (children !== null) {
 | 
				
			||||||
    // non slot object children (direct value) passed to a component
 | 
					    // non slot object children (direct value) passed to a component
 | 
				
			||||||
    if (__DEV__) {
 | 
					    if (__DEV__) {
 | 
				
			||||||
      // TODO show tip on using functions
 | 
					      warn(
 | 
				
			||||||
      console.log('use function slots!')
 | 
					        `Non-function value encountered for default slot. ` +
 | 
				
			||||||
 | 
					          `Prefer function slots for better performance.`
 | 
				
			||||||
 | 
					      )
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const normalized = normalizeSlotValue(children)
 | 
					    const normalized = normalizeSlotValue(children)
 | 
				
			||||||
    slots = { default: () => normalized }
 | 
					    slots = { default: () => normalized }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue