-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
翻页后点击详细页,返回时失效 #11
Comments
只有第一页是啥意思?能上个截图么? |
不好意思,可能表达不完整,我描述清晰一些。 <!-- 设置指令监听全局滚动条 -->
<div v-vuet-scroll.window="{ path: 'topic-list' }">
<header>
<ul>
<li v-for="item in list.tabs">
<router-link :to="{ name: 'topic-list', query: { tab: item.value } }">{{ item.label }}</router-link>
</li>
</ul>
</header>
<ul class="list" v-if="list.data.length">
<li v-for="item in list.data">
<router-link :to="{ name: 'topic-detail', params: { id: item.id } }">{{ item.title }}</router-link>
</li>
</ul>
<button @click="test">load</button>
</div>
</template>
<script>
import { mapRules, mapModules } from 'vuet'
export default {
mixins: [
// 设置模块的更新规则
mapRules({
route: 'topic-list'
}),
// 连接模块的状态
mapModules({
list: 'topic-list'
})
],
methods:{
test(){
var listss = this.list;
window.fetch(`https://cnodejs.org/api/v1/topics?mdrender=false&tab=all&limit=10`).then(function(response) {
return response.json();
}).then(function(json) {
console.log(json);
for (var i = 0; i < json.data.length; i++) {
listss.data.push(json.data[i]);
}
});
}
}
}
</script>
<style scoped>
header {
position: fixed;
top: 0;
right: 0;
left: 0;
z-index: 999;
border-bottom: 1px solid #ddd;
background: #fff;
}
header ul {
padding: 0;
margin: 0;
display: flex;
}
header ul li {
flex: auto;
list-style: none;
}
header ul li a {
display: block;
line-height: 50px;
text-align: center;
}
.list {
padding-top: 50px;
}
</style> |
你代码有提交到github上面吗?我可以看得更全一下 |
不好意思,现在无法上传,我给个百度云的链接,下载运行可否? |
你修改成这样试试 <button @click="$vuet.fetch('topic-list')">load</button> 另外,请求更新模块的数据,统一放到fetch方法中 |
用这个方法,翻页如何传递参数呢? |
翻页和vuet没有什么关系。肯定是可以 的 |
假如列表存在翻页,进入详细页返回时,列表只有第一页。
The text was updated successfully, but these errors were encountered: