renderer: add basic pinia sample
This commit is contained in:
1 parent
edc7a835e1
commit
149a9b4862
3 files changed
+27
-22
No files matched your search
@@ -1,13 +1,8 @@
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
Unknown error occurred
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
setup () {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -1,19 +1,14 @@
|
||||
<script setup>
|
||||
import { ref } from 'vue'
|
||||
import { useTempStore } from '../../store/temp'
|
||||
|
||||
const test = ref(1)
|
||||
const temp = useTempStore()
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div>
|
||||
Main Screen {{ test }}
|
||||
{{ temp.text }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ref } from 'vue'
|
||||
|
||||
export default {
|
||||
setup () {
|
||||
const test = ref(1)
|
||||
|
||||
return {
|
||||
test
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -0,0 +1,15 @@
|
||||
import { defineStore } from 'pinia'
|
||||
|
||||
export const useTempStore = defineStore('temp', {
|
||||
state: () => ({
|
||||
text: 'Sample Text'
|
||||
}),
|
||||
getters: {
|
||||
getText: (state) => state.text
|
||||
},
|
||||
actions: {
|
||||
setText (text) {
|
||||
this.text = text
|
||||
}
|
||||
}
|
||||
})
|
||||
Reference in new issue
Block a user