WebView

Requires:
@ray-js/ray≥0.6.9

Description

A container that hosts web pages; in Mini Programs it typically fills the entire page. When a page contains a web-view tag, other elements are not displayed, and you cannot apply any styles to it.

Props

PropertyTypeRequiredDefaultDescription
srcstringNo""The URL loaded by webview. You must sign in to the Mini Program management console and configure the webview domain at Mini Program Details -> Development Settings -> Multi-zone Server Domains -> webview whitelisted domains.
No-Triggers when the page fails to load
No-Triggers when the page loads successfully
No-Triggers at specific times and delivers the messages when the page posts to the mini program (back navigation, component teardown, sharing)
updateLayoutunknownNo-Used for cross-layer components to notify the container layer to update styles

Examples

Basic usage

import React from 'react';
import { WebView, View } from '@ray-js/ray';

export default function () {
  return (
    <WebView
      src="https://www.tuya.com"
      onLoad={(e) => console.log('Page loaded:', e.detail.src)}
      onError={(e) => console.log('Page load failed:', e.detail)}
    />
  );
}
Scan with SmartLife App to Try
Download Sample Code