tuns-mobile-components
Version:
Tuns Design UI
32 lines (27 loc) • 629 B
JavaScript
import React from "react";
import Text from "../../../components/mobile/src/customtext";
const onClick = text => {
console.log(text); // eslint-disable-line
};
const customRender = (text, index) => {
if (text === "特殊") {
return (
<a
key={`custom_text_${index}`}
style={{ color: "blue" }}
onClick={onClick.bind(null, text)}
>
{text}
</a>
);
}
return text;
};
const CustomTextDemo = () => {
return (
<Text customRender={customRender}>
这是一段 特殊 的文本,对,很 特殊 的文本
</Text>
);
};
export default CustomTextDemo;