fix: 修复 NPS 组件状态共享的问题
- 脱离 hooks,避免共享一个状态
This commit is contained in:
@@ -32,8 +32,9 @@
|
|||||||
<RateCharacter
|
<RateCharacter
|
||||||
:config="element.config"
|
:config="element.config"
|
||||||
:index="optionIndex"
|
:index="optionIndex"
|
||||||
|
v-model:model="value"
|
||||||
@change="handleRateChange"
|
@change="handleRateChange"
|
||||||
></RateCharacter>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -45,6 +46,7 @@
|
|||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import RateCharacter from './RateCharacter.vue';
|
import RateCharacter from './RateCharacter.vue';
|
||||||
|
|
||||||
|
const value = defineModel('value', { default: -1, type: Number });
|
||||||
const isPreview = defineModel('isPreview', { default: false, type: Boolean });
|
const isPreview = defineModel('isPreview', { default: false, type: Boolean });
|
||||||
/* const props = */ defineProps({
|
/* const props = */ defineProps({
|
||||||
index: {
|
index: {
|
||||||
|
|||||||
@@ -16,8 +16,8 @@
|
|||||||
|
|
||||||
<script setup>
|
<script setup>
|
||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
import { value as model } from '@/views/Design/components/Questions/hooks/useNPSHooks';
|
|
||||||
|
|
||||||
|
const model = defineModel('model', -1);
|
||||||
const rateItem = ref([
|
const rateItem = ref([
|
||||||
{
|
{
|
||||||
label: 1,
|
label: 1,
|
||||||
|
|||||||
@@ -4,14 +4,12 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import NPS from '@/views/Design/components/Questions/NPS.vue';
|
import NPS from '@/views/Design/components/Questions/NPS.vue';
|
||||||
import { watch } from 'vue';
|
import { watch, ref } from 'vue';
|
||||||
import { value } from '@/views/Design/components/Questions/hooks/useNPSHooks';
|
|
||||||
|
|
||||||
|
const value = ref(-1);
|
||||||
// // 预览新增 emit ['changeAnswer', 'previous', 'next']
|
// // 预览新增 emit ['changeAnswer', 'previous', 'next']
|
||||||
const emit = defineEmits(['changeAnswer', 'previous', 'next', 'update:element']);
|
const emit = defineEmits(['changeAnswer', 'previous', 'next', 'update:element']);
|
||||||
|
|
||||||
const question = defineModel<question>('question', { default: { config: { is_required: false } } });
|
const question = defineModel<question>('question', { default: { config: { is_required: false } } });
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* answer 的答案类型
|
* answer 的答案类型
|
||||||
* {
|
* {
|
||||||
@@ -24,7 +22,6 @@ const answer = defineModel<NPSAnswerType>('answer', { default: undefined });
|
|||||||
// function parseAnswer() {
|
// function parseAnswer() {
|
||||||
// return answer.value[`1`];
|
// return answer.value[`1`];
|
||||||
// }
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成NPS答案
|
* 生成NPS答案
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user