vue.js 파일 내의 v-if에서 메서드를 호출합니다.

나는 vue.js에 꽤 익숙하지 않다.해결해야 할 사소한 문제가 있어서 한 가지 도움이 필요합니다. 기존 메서드를 가진 vue.js 파일이 하나 있습니다. doSomething(){ //updates few properties here } 이제 목록/어레이 계산 속성이 pageUser()라고 합시다.또, 언제라도 doSomething을 호출하고 싶습니다.pageUser.length == 0. vue.js에서 이 작업을 수행하는 방법, 모든 태그에서 v-if를 사용할 수 있으며 여기서 메서드를 호출할 수 있는 방법 … Read more

XmlHttpRequest에서 마지막으로 수신한 값을 해석하고 가져오려면 어떻게 해야 합니까?

SseEmiter를 반환하는 웹 서비스가 있습니다. 로드 바를 프로그래밍하는 데 사용하고 있지만…받는 방법은 다음과 같습니다. static async synchronize(component: Vue) { let xhr = new XMLHttpRequest(); xhr.open(‘PATCH’, ‘myUrl.com’); xhr.responseType = “text” xhr.setRequestHeader(‘Authorization’, ‘mySessionToken’) xhr.setRequestHeader(“Content-Type”, “text/event-stream”) xhr.onload = function () { if (this.status >= 200 && this.status < 300) { resolve(xhr.response) } else { reject({status: this.status, statusText: xhr.statusText}) … Read more

typescript 어떻게 다른 인수의 유형에서 한 인수의 유형을 추론할 수 있는가?

type ChartType = ‘bar’ ‘line’ ‘pie’; interface PropsType { type: EChartType; xData: **** ; seriesData: **** ; } const props = defineProps<PropsType>(); 하는 방법 언제ChartType = ‘bar’,xData타입이 있다string[]그리고.seriesData타입이 있다number[].언제ChartType = ‘line’,xData타입이 있다Array<string number>그리고.seriesData타입이 있다string[].언제ChartType = ‘pie’,xData타입이 있다number[]그리고.seriesData타입이 있다{value:string,name:string}[]. 질문에 대한 답변 이것이 당신의 질문에 대한 대답입니다. type TPropsType = { type: “bar” xData: string[] seriesData: … Read more

Vue 앱의 사전 커밋 후크에서 TS 오류 확인

그래서 저희 앱에는 허스키를 사용한 깃 훅이 있습니다.누군가 코드를 커밋하면 사전 커밋 코드를 실행합니다. #!/bin/sh . “$(dirname “$0″)/_/husky.sh” export NVM_DIR=”$HOME/.nvm” [ -s “$NVM_DIR/nvm.sh” ] && . “$NVM_DIR/nvm.sh” nvm use npx lint-staged 패키지에 넣어주세요.json은 – “lint-staged”: { “*.(js ts vue)”: “eslint –cache –fix –max-warnings=0” } 보풀 에러는 검출되지만, 프로젝트의 타이프 스크립트의 문제는 검출되지 않습니다.예를 들어 호출 … Read more

Vuex 스토어 getter가 페이지 새로 고침 시 [_ob__: Observer]를 반환합니다.

다음 코드를 지정하면 Veux 스토어 getter가 반환됩니다.[__ob__: Observer]페이지 새로고침 할 때마다.Vue 2.2.3과 TypeScript를 사용하고 있습니다. 외부 API에서 가져온 첫 번째 로드에서 데이터가 올바르게 로드되지만 getter를 사용하면 실패하고 페이지 데이터를 가져오기 위해 API를 다시 호출해야 합니다. 초기 페이지 로드 후의 콘솔로그를 다음에 나타냅니다. [{…}, {…}, {…}, {…}, __ob__: Observer] 4개의 오브젝트가 있으며, 정답이며, 데이터가 페이지에 표시됩니다.근데 … Read more

버전으로 인해 vue-tsc와 volar가 충돌합니다.

vsCode에서 문제가 발생했음을 알립니다. ❗ 다른 vue-tsc 버전 Vue 언어 기능(Volar)의 버전은 1.0.9이지만 작업 공간의 vue-tsc 버전은 0.39.5입니다.이로 인해 다른 유형의 체크 동작이 발생할 수 있습니다. vue-tsc: /home/tomas/Desktop/testing the kid/viteFiles/typscript/typescript-and-vue-workshop/app/node_modules/vue-tsc/package.json 그래서 검색해보니 vue-tsc의 최신 버전을 설치하는 것과 유사한 문제가 해결되었습니다. 둘 다 동일하고 문제가 해결되어야 합니다.제 경우, 저는 그것을 했고 .json 파일이 바뀌었습니다.실제로 지금은”vue-tsc”: “^1.0.9″그러나 … Read more

변수 유형에 연결된 인터페이스 콘텐츠 유형

2개의 인터페이스 필드를 어떻게 묶을 수 있을까요?인터페이스는 다음과 같습니다. export interface IContractKpi { type: ‘shipmentVolumes’ ‘transitTime’ ‘invoices’; visible: boolean; content: IKpiContent; } export type IKpiContent = IKpiShipmentVolumeContent[] IKpiTransitTimeContent[] IKpiInvoicesContent; 제가 하고 싶은 것은 다음 사항을 알기 위한 타이프스크립트입니다. 언제type– 아니, 아니에요! – 왜요?’shipmentVolumes’,content– 아니, 아니에요! – 왜요?IKpiShipmentVolumeContent[]. 언제type– 아니, 아니에요! – 왜요?’transitTime’,content– 아니, 아니에요! – … Read more

어레이 내의 오브젝트 각 요소에 액세스(vue + ts)

TypeError: Cannot read properties of undefined (reading ‘0’) at Proxy.render (form1.vue?4692:190:1) at renderComponentRoot (runtime-core.esm-bundler.js?5c40:893:1) form1.vue?4692:190 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘0’) at Proxy.render (form1.vue?4692:190:1) at renderComponentRoot (runtime-core.esm-bundler.js?5c40:893:1) at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js?5c40:5030:1) at ReactiveEffect.run (reactivity.esm-bundler.js?a1e9:160:1) 에러가 발생했습니다. <input type=”text” class=”form-control” v-model=”data[‘item3’][0].item1″ /> 데이터 전송처: item3: [ { item1: ‘SSS’, item2: … Read more

어레이 내의 오브젝트 각 요소에 액세스(vue + ts)

TypeError: Cannot read properties of undefined (reading ‘0’) at Proxy.render (form1.vue?4692:190:1) at renderComponentRoot (runtime-core.esm-bundler.js?5c40:893:1) form1.vue?4692:190 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading ‘0’) at Proxy.render (form1.vue?4692:190:1) at renderComponentRoot (runtime-core.esm-bundler.js?5c40:893:1) at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js?5c40:5030:1) at ReactiveEffect.run (reactivity.esm-bundler.js?a1e9:160:1) 에러가 발생했습니다. <input type=”text” class=”form-control” v-model=”data[‘item3’][0].item1″ /> 데이터 전송처: item3: [ { item1: ‘SSS’, item2: … Read more

유형 ‘never’.ts에 속성이 없습니다.

기존 Vue 프로젝트에 Typescript를 추가합니다.다음과 같은 방법이 있습니다. const markImportant = (isImportant: boolean): void => { for (let email of store.selectedEmail) { if (isImportant) { email.important = isImportant; updateImportant(email); } }; 선택한 Email 객체를 저장하기 위해 pinia 스토어를 사용하고 있습니다.다음의 에러 메세지가 표시됩니다. 유형 ‘never’에 ‘important’ 속성이 없습니다.ts(2339) 중요한 값은 true 또는 false일 수 있습니다. … Read more

구문 분석 오류:

Typescript가 있는 Quasar 응용 프로그램이 있습니다.Quasar 문서를 기반으로 나중에 Typescript를 추가했습니다. 다음의 에러 메세지가 표시됩니다. VSCode의 파일에는 다른 오류나 경고는 없지만 브라우저에서 다음과 같은 오류가 발생합니다. [eslint] D:…srccomponentsAttachment.vue 88:16 error Parsing error: Unexpected token, expected “,” (52:16) ESlint 설정에 문제가 있습니까?아니면 어떤 해결책이 있을까요? 질문에 대한 답변 갱신했습니다..eslintrc.jsQuasar 문서를 기반으로 하며 잘 작동합니다.

vue CLI를 사용하지 않고 vue 3에서 타이프스크립트 사용

vue를 사용하여 aspnet 핵심 프로젝트에서 생성된 페이지를 보강하는 기존 웹 프로젝트를 조사 중입니다.클라이언트측은 이미 Javascript 6+(모듈을 사용하는 등)로 쓰여져 있으며, 타이프스크립트로 고쳐 쓸 수 있는지 확인하는 것이 목적입니다. 데모 코드는 이미 Javascript 6+로 작성되어 있기 때문에 타이프 스크립트로 갱신하는 것은 그다지 어렵지 않습니다만, 옵션 api를 사용하고 있고 vue 컴포넌트와 그 CLI를 사용하지 않을 때는 타입 … Read more