小编Luc*_*sNa的帖子

本地搜索 v-data-table Vuetify

我有一个对象数组:productos[],我用它来填充v-datatable.

我一直在尝试添加搜索texfield,如Vuetify文档所述。我已经添加了这个,但它只适用于(出于某种原因)带有数字的标题,并且它不起作用,例如当你输入一个字符串时。

我想我做错了什么。

搜索文本字段:

  <v-text-field
   v-model="search"
   append-icon="search"
   label="Search"
    single-line
    hide-details
 ></v-text-field>
Run Code Online (Sandbox Code Playgroud)

v-数据表

   <v-data-table
          :headers="headers"
          :items="productos"
          :search="search"
          hide-actions
          class="elevation-1"
        >
          <template slot="items" slot-scope="props">
            <td class="text-xs-left">{{ props.item.ListadoProductoId }}</td>
            <td class="text-xs-left">{{ props.item.ListadoProducto.nombre }}</td>
            <td class="text-xs-left"> ${{ props.item.ListadoProducto.precio }}</td>
            <td class="text-xs-left">{{ props.item.disponible }}</td>
            <td class="text-xs-left">{{ props.item.ListadoProducto.lim_falt }}</td>
            <td class="text-xs-left">{{ props.item.ListadoProducto.lim_exc }}</td>
</v-data-table>
Run Code Online (Sandbox Code Playgroud)

标题和其他一些脚本:

export default {
  data () {
    return {
      error: null,
      search: '',
      headers: [
        {text: 'ID_PROD', value: 'ListadoProductoId', sortable: false},
        {text: 'Nombre', value: …
Run Code Online (Sandbox Code Playgroud)

javascript vue.js vue-component vuejs2 vuetify.js

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

任务执行失败:app:processDebugManifest Android Studio 2.3.3

添加CardViewRecyclerView依赖项后,我收到编译错误,我已检查过每个帖子,但似乎没有人解决这种情况.

错误:

错误:任务':app:processDebugManifest'的执行失败.清单合并失败:来自[com.android.support:appcompat-v7:25.3.1]的属性meta-data#android.support.VERSION@value value =(25.3.1)AndroidManifest.xml:27:9-31也是出现在[com.android.support:cardview-v7:26.0.0-alpha1] AndroidManifest.xml:24:9-38 value =(26.0.0-alpha1).建议:在AndroidManifest.xml:25:5-27:34中添加'tools:replace ="android:value"'来覆盖.

我的Build.Gradle:

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "26.0.0"
    defaultConfig {
        applicationId "com.soft.kukito.cardviewprueba"
        minSdkVersion 21
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
}

dependencies {
    compile fileTree(include: ['*.jar'], dir: 'libs')
    androidTestCompile('com.android.support.test.espresso:espresso-core:2.2.2', {
        exclude group: 'com.android.support', module: 'support-annotations'
    })
    compile 'com.android.support:appcompat-v7:25.3.1'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    testCompile 'junit:junit:4.12'
    compile 'com.android.support:cardview-v7:26.0.0-alpha1'
    compile 'com.android.support:recyclerview-v7:26.0.0-alpha1'
}
Run Code Online (Sandbox Code Playgroud)

感谢大家的回答.

android android-support-library android-studio android-gradle-plugin android-recyclerview

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

使用异步操作 Vuex 加载状态

我无法意识到如何让它工作。

我正在尝试在我的 data() 上加载一个属性(productos),它必须从状态中捕获值。

我的组件:

    data () {
        return {
          productos: this.$store.state.mStock.productos
        }
     },
  created() {
    this.$store.dispatch('fetchProductos')
  }
Run Code Online (Sandbox Code Playgroud)

在这一点上,我认为没关系,当我加载我的组件时,我会分派我的动作来加载商店的状态。 我认为问题是我填写状态的方式是ASYNC

店铺:

import StockService from '@/services/StockService'

export const moduleStock = {
  strict: false,
  state: {
    productos: []
  },
  mutations: {
    setProductos (state, payload) {
      state.productos = payload.productos
    }
  },
  actions: {
    async fetchProductos ({commit}, payload) {
      const resp = await (StockService.getProductos())
      var productos = resp.data
      commit('setProductos', {productos: productos})
    }
  }
}
Run Code Online (Sandbox Code Playgroud)

当我加载我的组件时,data() 上的属性“productos”为空,但是如果我从 Vuex devtools 中看到“state.productos”,它就有数据!

我搞砸了。

javascript asynchronous async-await vue.js vuex

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