Incorporation of perovskite nanocrystals into lanthanide metal-organic frameworks with enhanced stability for ratiometric and visual sensing of mercury in aqueous solution.