‘string’ 유형은 ‘ComputedRef’ 유형에 할당할 수 없습니다.< string >

Vue 앱에 다음 코드가 있습니다.제가 하고 싶은 건 소품을 바탕으로 컬러 특성을 바꾸는 거예요.컴포넌트 외부에서 색상 특성이 변경될 수 있기 때문에 computed도 사용합니다.

export default defineComponent({
name: 'mail-dropdown',
props: {
title: {
type: String,
default: '',
// required: true
},
id: {
type: String,
},
shade: {
type: String,
default: 'white',
},
grey: {
type: Boolean,
default: false,
// required: true
},
items: { type: Object as PropType<ActionItem[]> },
},
setup(props, context) {
const store = useCounterStore();
let color = computed(() => props.shade);
if (props.grey == true) {
color = 'grey-5';
};
return { store, color };
}, }); 

에러가 발생했습니다.

if (props.grey == true) {
color = 'grey-5'; }; 

에러는 다음과 같습니다.

> let color: ComputedRef<string>
Type 'string' is not assignable to type 'ComputedRef<string>'. 

변경에 대한 해결책은 무엇입니까?color?



질문에 대한 답변