小编MrR*_*Red的帖子

在 vuejs 中使用转换时固定元素在屏幕上跳转

在 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)

transition routes vue.js

6
推荐指数
1
解决办法
1492
查看次数

在 Android 上的 Realm 中,我收到“字段已存在”错误,但它是全新安装的?

好的。所以我从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)

migration android realm

5
推荐指数
1
解决办法
1308
查看次数

在Android上的Realm中,如何迁移(添加)新的链接字段

好的,所以我有一个比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)

migration android realm

4
推荐指数
1
解决办法
469
查看次数

如何使用Retrofit/Android将位图发布到服务器

我正在尝试使用Android和将位图发布到服务器Retrofit.

目前我知道如何发布文件,但我更喜欢直接发送位图.

这是因为用户可以从他们的设备中挑选任何图像.我想在发送到服务器之前调整它以节省带宽,并且最好不必加载它,调整大小,将其作为文件保存到本地存储然后发布文件.

有人知道如何发布位图Retrofit吗?

android retrofit

3
推荐指数
1
解决办法
1万
查看次数

如何防止按下浏览器后退按钮时 Vuejs 滚动到页面顶部

当您按下后退按钮时,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

vue.js vue-router

3
推荐指数
1
解决办法
2808
查看次数

标签 统计

android ×3

migration ×2

realm ×2

vue.js ×2

retrofit ×1

routes ×1

transition ×1

vue-router ×1