MCPcopy Create free account
hub / github.com/Xu22Web/tech-study-js / createTextNode

Function createTextNode

tech-study.js:1896–1917  ·  view source on GitHub ↗

* @description 创建文字节点 * @param text * @returns

(text, options)

Source from the content-addressed store, hash-verified

1894 * @returns
1895 */
1896function createTextNode(text, options) {
1897 const { onCreated, beforeCreat, onMounted, beforeMount } = options || {};
1898 // 创建元素前
1899 beforeCreat && beforeCreat();
1900 // Ref
1901 if (isRef(text)) {
1902 // ref
1903 const refVal = text;
1904 // 元素
1905 const ele = document.createTextNode('');
1906 // 订阅变化
1907 watchEffect(() => {
1908 ele.data = refVal.value;
1909 });
1910 // 创建元素后
1911 onCreated && onCreated();
1912 return { ele, beforeMount, onMounted };
1913 }
1914 // 创建元素后
1915 onCreated && onCreated();
1916 return { ele: document.createTextNode(String(text)), beforeMount, onMounted };
1917}
1918/**
1919 * @description 挂载元素
1920 * @param eleOptions

Callers 14

TipFunction · 0.70
HrFunction · 0.70
SelectFunction · 0.70
ExamBtnFunction · 0.70
LoginItemFunction · 0.70
InfoItemFunction · 0.70
ScoreItemFunction · 0.70
NomalItemFunction · 0.70
TaskItemFunction · 0.70
TaskBtnFunction · 0.70
ScheduleListFunction · 0.70
TimeInputFunction · 0.70

Calls 2

isRefFunction · 0.70
watchEffectFunction · 0.70

Tested by

no test coverage detected