그냥 간단한 질문.
리로드하려면 / 재계산할 설명하였노라 부에드제스 인력용 수 있습니까? 그렇다면, 어떻게?
이 매직 시도하시겠습니까 맞춤법.
vm.$forceUpdate();
만들지 않아도 내어쓰기는 var:)
여기에 자세한 정보: https://vuejs.org/v2/guide/computed.html
이 솔루션은 예쁜 청소하십시오 같다 [마티아스크] (https://github.com/matthiasg) 에서 [이 문제] (https://github.com/vuejs/Discussion/issues/356):
>. ',' 및 변경하십시오 키 사용할 수도 있습니다. = " somevariableunderyourcontrol" 주요 구성 요소를 완전히 재구축되지 싶을 때
내 览侩 荤례 있었는데, 어느 한 getter 붙여넣습니다 컴포넌트인지 브루스 먹고 있다. 하지만 줄어들게 되어, t # 39 킥 wouldn& 브루스 페치할 아니하였으매 짐작이지만요. 데이터를 안정적으로 다시 렌더링 인되며 구성 요소. 제 경우에는 주요 구성 요소 '설정' 것이라고 할 수 있는 속성을 제안 때 재생율에서 게터 (및 속성) 마침내 타결됐다.
.do 너회가 medianame 강제하는 업데이트할까요?
아마 당신은 최고의 성능으로 브루 탐험이요 않습니다.
>. 변화에 대응할 수 있는 값을 자동으로 브루 객체에는 선언된 xam 데이터 '' 합니다. 부에벌린세스 () 또는, 그렇지 않을 경우에는 사용하여 추가된 '해야' .
데모 아래 설명 참조. 또는 열어보려면 [동일한 데모 이스피들 a here] [1].
<! - begin 스니핏: js 숨기십시오: 거짓값 콘솔: 거짓값 바벨. > 거짓값 -;
new Vue({
el: '#app',
data: {
person: {
name: 'Edson'
}
},
methods: {
changeName() {
// because name is declared in data, whenever it
// changes, Vue automatically updates
this.person.name = 'Arantes';
},
changeNickname() {
// because nickname is NOT declared in data, when it
// changes, Vue will NOT automatically update
this.person.nickname = 'Pele';
// although if anything else updates, this change will be seen
},
changeNicknameProperly() {
// when some property is NOT INITIALLY declared in data, the correct way
// to add it is using Vue.set or this.$set
Vue.set(this.person, 'address', '123th avenue.');
// subsequent changes can be done directly now and it will auto update
this.person.address = '345th avenue.';
}
}
})
/* CSS just for the demo, it is not necessary at all! */
span:nth-of-type(1),button:nth-of-type(1) { color: blue; }
span:nth-of-type(2),button:nth-of-type(2) { color: red; }
span:nth-of-type(3),button:nth-of-type(3) { color: green; }
span { font-family: monospace }
<script src="https://unpkg.com/vue"></script>
<div id="app">
<span>person.name: {{ person.name }}</span><br>
<span>person.nickname: {{ person.nickname }}</span><br>
<span>person.address: {{ person.address }}</span><br>
<br>
<button @click="changeName">this.person.name = 'Arantes'; (will auto update because `name` was in `data`)</button><br>
<button @click="changeNickname">this.person.nickname = 'Pele'; (will NOT auto update because `nickname` was not in `data`)</button><br>
<button @click="changeNicknameProperly">Vue.set(this.person, 'address', '99th st.'); (WILL auto update even though `address` was not in `data`)</button>
<br>
<br>
For more info, read the comments in the code. Or check the docs on <b>Reactivity</b> (link below).
</div>
끝 - < 스니핏 >;!
이 부분을 브루 마스터, [ - 줄어들게 되어 있는 공식 문서 변경 감지 시] 확인 [2]. 컴포지션이 필독!
[2]: https://vuejs.org/v2/guide/reactivity.html # 변경 감지 시
사용 ' (# 39, & # 39, varName&, 값) vmo. $ 설정되었습니다'. [Change_Detection_Caveats] 에 포착하십시오 (자세한 내용은 http://vuejs.org/guide/reactivity.html # Change_Detection_Caveats).
이 읽어보시기 바랍니다. http://michaelnthiessen.com/force-re-render/
끔찍한 방법으로: 전체 페이지를 리로드하지 < br>; 끔찍한 방법으로: 해킹 < 만약 v 사용하여 br>; 더 좋은 방법입니다. , < 브루 에 내장된 포스업다이트 방법을 사용하여 br>. 가장 좋은 방법입니다. , < br> 컴포넌트인지 따라 키 변경.
<template>
<component-to-re-render :key="componentKey" />
</template>
<script>
export default {
data() {
return {
componentKey: 0,
};
},
methods: {
forceRerender() {
this.componentKey += 1;
}
}
}
</script>
나 또한 list. 제스쳐놀이처럼: 경우에 따라.
그러거라 언제든지 다시 렌더링 (레크리에이션) 키를 사용하여 강제로 속성용 됩니다.
"'<;;;; > somevalueunderyourcontrol" 마이콩폰랑 키 = " < /mycomponent>."
예 참조
전송되었기 백서입니다 있습니다. https://github.com/vuejs/Discussion/issues/356 # issuecomment-336060875
/ / 새로고치기 컴포넌트용, 정지점을 리로드하려면 위해 다시 렌더링 긴 코딩. 부에드제스 길을 그렇게 할 수 있습니다.
'속성' 키 됩니다.
예를 들면 다음과 같습니다.
"' < 내 구성 요소 키 = " unique";; />. "'
나는 한 표 사용하는 BS 브루 슬롯입니다. 그래서 뭔가 말하고 있는 이 구성 요소에 대한 내아기마저도 고유하게.
어쨌든 사용되는 다른 방법은 대개 '' 브루 러우터 관련된 대부분의 어플리케이션.
예를 들어, 필요한 경우 업데이트 hooks& 업데이트되도록 / # 39. 모든 구성 요소 중 일부 내용만 실행 / 빛위에 페이지. 라우트를 업데이트하던 관심을 갖게 될 수 없는 구성 요소 (section 을 component& 경로설정을 사용되지 않는다 # 39 의 속성 값), 그래서 이동줄에 경비 트리거할 않습니다. 또한 수 있는 컴포넌트, 내 말은 피할 수 있는 질문을 재사용됩니다 받으라니깐 브루 캐시에서 트리거하기 수명주기의 후크. 그래서, 이런 경우 여전히 할 수 있는 가치를 전달하여 고유해야 경로설정할 컴포넌트인지 러우터 같은 목표 달성
path: ":model",
name: "model",
component: MyComponent,
props: (route) => ({
// other props...
timestamp: + new Date()
})
그럼 소품 등 '이 제안 수용해야 한다. [# 39, & # 39, timestamp&] '를 구성, 통과시킬 수 있는 하위 구성 요소에 대한 관심이 높아지고 있는 업데이트하십시오 라우트를 다운되어도 있습니다. 그 후 속성으로 협력하였습니다 요소이거나 인사이드라면 태그이고, 보이지 않는 사용한다. # 39, t 에 이를 사용할 경우 don& 템플리트와 발생하지는 않을 것이라고 어디든요 없는 경우 - hit 라우팅하는 고유한 값을 업데이트 때마다 생성되어 라우트를 전달할 수 있는 컴포넌트 및 하위 값을 통해 전달되는 특성을 사용하여 그들의 업데이트하십시오 템플릿에는 일으킬 수 있다.
= $ route.params.param1" 키 "; 그냥 사용할 수 있는 모든 params) 등 주요 자동차 리로드하려면 있다.
이 문제로 인해 다시 렌더링 이미지를 갖고 있는 갤러리 변경 내용을 다른 탭을 싶었다. 그래서 tab1 이마지갈리 파보이타이마주 tab2 =, =
탭 @change = " " 업다테갈리 ();; - >. 이렇게 하면 내 v-에 대한 디렉티브을 필테레지마주 때마다 내가 처리할 수 있는 기능을 스위치였습니다 탭들.
<script>
export default {
data() {
return {
currentTab: 0,
tab: null,
colorFilter: "",
colors: ["None", "Beige", "Black"],
items: ["Image Gallery", "Favorite Images"]
};
},
methods: {
filteredImages: function() {
return this.$store.getters.getImageDatabase.filter(img => {
if (img.color.match(this.colorFilter)) return true;
});
},
updateGallery: async function() {
// instance is responsive to changes
// change is made and forces filteredImages to do its thing
// async await forces the browser to slow down and allows changes to take effect
await this.$nextTick(function() {
this.colorFilter = "Black";
});
await this.$nextTick(function() {
// Doesnt hurt to zero out filters on change
this.colorFilter = "";
});
}
}
};
</script>