在 vue 中使用路由之间的过渡时,似乎固定或绝对元素仅在过渡完成后移动到它们的位置,从而导致动画后跳转。这可能是一个错误?
这是一个代码笔示例:https ://codepen.io/anon/pen/ebyOYx
HTML:
<div id="app"></div>
<template id="root-template">
<div class="routes">
<nav>
<router-link to="/" exact>Home</router-link>
<router-link to="/contact">Contact</router-link>
</nav>
<transition name="slide-left" mode="out-in">
<keep-alive>
<router-view></router-view>
</keep-alive>
</transition>
</div>
</template>
<template id="home-template">
<div class="page">
<h1>Home Page</h1>
Go to the Contact page and notice the fixed toolbar jumping after transition
</div>
</template>
<template id="contact-template">
<div class="page">
<h1>Contact Page</h1>
<div class="toolbar">
Toolbar
</div>
</div>
</template>
<template id="404-template">
<div class="page">
<h1>404 Not Found</h1>
</div>
</template>
Run Code Online (Sandbox Code Playgroud)
爪哇脚本:
const HomePage = {
name: 'HomePage',
template: '#home-template' …Run Code Online (Sandbox Code Playgroud) 好的。所以我从Android中完全删除了我的应用程序。然后在全新安装时出现错误
Field already exists in 'PortfolioCoin': color.
Run Code Online (Sandbox Code Playgroud)
为什么领域尝试在全新安装上迁移?
我在我的申请文件中找到了这个
Realm.init(this);
RealmConfiguration configuration = new RealmConfiguration.Builder()
.name(Realm.DEFAULT_REALM_NAME)
.schemaVersion(1)
.migration(new Migration())
//.deleteRealmIfMigrationNeeded()
.build();
Realm.setDefaultConfiguration(configuration);
Realm.compactRealm(configuration);
Run Code Online (Sandbox Code Playgroud)
这是我的迁移文件
public class Migration implements RealmMigration {
@Override
public void migrate(final DynamicRealm realm, long oldVersion, long newVersion) {
// During a migration, a DynamicRealm is exposed. A DynamicRealm is an untyped variant of a normal Realm, but
// with the same object creation and query capabilities.
// A DynamicRealm uses Strings instead of Class references because the …Run Code Online (Sandbox Code Playgroud) 好的,所以我有一个比Coin领域对象还多的应用程序。我现在正在升级我的应用程序,并将多个新字段添加到现有的Coin对象。到目前为止一切顺利,但是我该如何迁移LinkingObject,RealmResults类型。linkedPortfolioCoins是我想要迁移的
public class Coin extends RealmObject {
//a bunch of other fields here
@LinkingObjects("coin")
private final RealmResults<PortfolioCoin> linkedPortfolioCoins = null;
}
Run Code Online (Sandbox Code Playgroud)
而且,只有
.addRealmListField
Run Code Online (Sandbox Code Playgroud)
我认为可以代替RealmResults使用,但是如何使它成为Coin的LinkingObject。
我得到的错误是
Caused by: io.realm.exceptions.RealmMigrationNeededException: Field count is more than expected - expected 18 but was 19
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Android和将位图发布到服务器Retrofit.
目前我知道如何发布文件,但我更喜欢直接发送位图.
这是因为用户可以从他们的设备中挑选任何图像.我想在发送到服务器之前调整它以节省带宽,并且最好不必加载它,调整大小,将其作为文件保存到本地存储然后发布文件.
有人知道如何发布位图Retrofit吗?
当您按下后退按钮时,Vuejs 看起来会自动滚动到页面顶部,这很奇怪,因为默认情况下,当您在 SPA 中更改路由或转到新页面时,窗口甚至不会滚动到顶部。您需要显式设置scrollBehaviour以滚动到顶部。那么如何才能防止按下后退按钮时页面自动滚动到顶部呢?
beforeRouteLeave (to, from, next) {
alert('Are you sure you want to leave this page and lose unsaved changes')
// Notice how the page automatically scrolls to the top here even if the user were to response 'No' in a dialog situation
}
Run Code Online (Sandbox Code Playgroud)
这是问题的代码笔 https://codepen.io/anon/pen/bOGqVP