diff --git a/src/pages/index/index.jsx b/src/pages/index/index.jsx index b8a364d..639152d 100644 --- a/src/pages/index/index.jsx +++ b/src/pages/index/index.jsx @@ -1,6 +1,14 @@ import { Component } from "react"; import Taro from "@tarojs/taro"; -import { View, Text, Image, Button } from "@tarojs/components"; +import { + View, + Text, + Image, + Button, + Input, + Editor, + Textarea, +} from "@tarojs/components"; import "./index.scss"; import { AtTabBar } from "taro-ui"; import React, { useCallback, useEffect, useState } from "react"; @@ -60,19 +68,23 @@ renderer.list = function (body, ordered, start) { // 不含▫️的元素数量 // const diffcCount=texts.length-texts.filter(item => item.includes('▫️')).length; console.log("texts===>", texts); // 输出: ["测试111", "测试222", "if"] - const newArray = texts.filter(item => item.includes('▫️')); + const newArray = texts.filter((item) => item.includes("▫️")); // 0️⃣', const numbers = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"]; const string = texts .map((value, index) => { console.log("value, index==>", value, index); // ${ value.indexOf("▫️ ") === -1 ? '
111' : ""} - return value.indexOf("▫️ ") !== -1 ?`
${type === "ol" ? numbers[newArray.indexOf(value)] : "▫️ "}${value.replace('▫️ ','')}
`:`
\t${value}
`; + return value.indexOf("▫️ ") !== -1 + ? `
${ + type === "ol" ? numbers[newArray.indexOf(value)] : "▫️ " + }${value.replace("▫️ ", "")}
` + : `
\t${value}
`; }) .join(""); // return `1️⃣` console.log("string===>", string); - + return `${string}`; }; @@ -146,22 +158,54 @@ const markTextStr = marked( 相信我 ` ); + + // export default class Index extends Component { const Index = () => { const [markText, setmarkText] = useState(null); + + const editorReady = (e) => { + Taro.createSelectorQuery() + .select("#editor") + .context((res) => { + this.editorCtx = res.context; + }) + .exec(); + }; + + const onConfirm = (onConfirmtxt) => { + console.log("onConfirmtxt--->",onConfirmtxt.detail.value); + }; + const onBlur = (onBlurtxt) => { + console.log("onBlurtxt--->", onBlurtxt.detail.value); + setmarkText(marked(onBlurtxt.detail.value)) + }; + const onBridgeReady = () => { WeixinJSBridge.call("hideOptionMenu"); }; useEffect(() => { // console.log("markTextStr=>", markTextStr); - // setmarkText(markTextStr); + setmarkText(marked(markTextStr)); }, []); return ( - + +