nuxt가 서버에서 데이터 데모를 요청합니다
더 이상 말하지 않고 바로 코드를 넣습니다.
페이지에 index를 추가합니다.vue
import AppLogo from '~/components/AppLogo.vue'
import axios from 'axios'
export default {
components: {
AppLogo
},
methods: {
login () {
axios({
withCredentials: true,
method: 'get',
url: `url`,
}).then((res) => {
this.$router.push('/show')
})
}
}
}
페이지에 show를 추가합니다.vue
=== {{ account }} ===
import axios from 'axios'
import sun from './sun'
export default {
data () {
return {
account: ''
}
},
methods: {
async getData () {
let { data } = await axios({
withCredentials: true,
method: 'get',
url: `url`
})
this.account = data.account
}
},
components: {
sun
},
created () {
this.getData ()
}
}
페이지에sun을 추가합니다.vue
+++ {{ papa }} +++
^^^ {{ pada }} ^^^
export default {
name: 'sun',
props: ['papa'],
data () {
this.$watch('papa', function(newVal, oldVal){
console.log(newVal)
this.pada = newVal
});
return {
pada: ''
}
}
}
이 내용에 흥미가 있습니까?
현재 기사가 여러분의 문제를 해결하지 못하는 경우 AI 엔진은 머신러닝 분석(스마트 모델이 방금 만들어져 부정확한 경우가 있을 수 있음)을 통해 가장 유사한 기사를 추천합니다:
LaravelAPI + Nuxt로 MultiAuth 구현현재 SIer5년째로 javascript(Jquery만), PHP(프레임워크 없음)를 2년 정도, C#(Windows 앱) 3년 정도 왔습니다. 여러가지 인연이 있어, 개인으로 최근 웹 서비스의 시작을 하게 되었습니...
텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
CC BY-SA 2.5, CC BY-SA 3.0 및 CC BY-SA 4.0에 따라 라이센스가 부여됩니다.