create-nodality-vue 1.0.0-beta.3 → 1.0.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/templates/src/App.vue
CHANGED
@@ -1,40 +1,39 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
},
|
34
|
-
renderText() {
|
35
|
-
this.$refs.renderedText.innerHTML = "";
|
36
|
-
this.text.render(this.$refs.renderedText);
|
37
|
-
},
|
38
|
-
},
|
39
|
-
};
|
1
|
+
<script setup>
|
2
|
+
import { useTemplateRef, onMounted, defineProps, defineEmits, watch } from 'vue'
|
3
|
+
//import {Text} from "../lib/TextCopy.js";
|
4
|
+
|
5
|
+
// Define props to accept the msg value
|
6
|
+
const props = defineProps({
|
7
|
+
msg: String,
|
8
|
+
text: Object
|
9
|
+
})
|
10
|
+
|
11
|
+
const emit = defineEmits(['update:msg'])
|
12
|
+
|
13
|
+
// the first argument must match the ref value in the template
|
14
|
+
const input = useTemplateRef('my-input')
|
15
|
+
let mycomp = useTemplateRef('my-comp')
|
16
|
+
|
17
|
+
onMounted(() => {
|
18
|
+
input.value.focus()
|
19
|
+
let ela = props.text.render();//document.createElement("h1");
|
20
|
+
mycomp.value.appendChild(ela);
|
21
|
+
})
|
22
|
+
|
23
|
+
watch(() => props.msg, () => { // 12:21:57 Wow!!!
|
24
|
+
|
25
|
+
mycomp.value.innerHTML = ""; // Clear existing content
|
26
|
+
const element = props.text.render(); // Call the render method
|
27
|
+
mycomp.value.appendChild(element);
|
28
|
+
})
|
29
|
+
|
30
|
+
function updateMessage(event) {
|
31
|
+
emit('update:msg', event.target.value)
|
32
|
+
}
|
40
33
|
</script>
|
34
|
+
|
35
|
+
<template>
|
36
|
+
<h2>Hello from static Vue</h2>
|
37
|
+
<input ref="my-input" :value="msg" @input="updateMessage" />
|
38
|
+
<div ref="my-comp"/>
|
39
|
+
</template>
|