Hướng dẫn react-native-html-parser - phản ứng gốc-html-trình phân tích cú pháp
0.1.0 & nbsp; • & nbsp; public & nbsp; • & nbsp; đã xuất bản 3 năm trướcPublic • Published 3 years ago Show
Có thể sử dụng trình phân tích cú pháp HTML trong phản ứng, titan và bất cứ nơi nào.Điều này dựa trên XMLDOM. NPM Cài đặt phản ứng-HTML-Parser phản ứng import React, { Component, View, Text, StyleSheet, TextInput, WebView, } from 'react-native' var DomParser = require('react-native-html-parser').DOMParser class TestReactNativeHtmlParser extends Component { componentDidMount() { let html = ` Test ` let doc = new DomParser().parseFromString(html,'text/html') console.log(doc.querySelect('#b .inA')) console.log(doc.getElementsByTagName('a')) console.log(doc.querySelect('#b a[href="example.org"]')) console.log(doc.getElementsByClassName('a', false)) } } hoặc
hoặc
Giải pháp lỗi[Lỗi xmldom] Không tìm thấy thực thể: ~~~~~~~Kiểm tra vấn đề này Tham khảo API
Phương thức và thuộc tính DOM Cấp độ2:
Hỗ trợ cấp 3 của DOM:
DomiMplementation
|