小编Mur*_*lık的帖子

Vue.js强制重新计算计算的属性?

这是我组件的计算属性:

methods: {
  addFavoritePlace(place_id) {
    axios.post('/api/add-favorite-place', { place_id: place_id })
      .then(response => {
        // I need here force command.
      });
  },
},

computed: {
  filteredPlaces: function () {
    var is_open;

    if (this.showOpened) {
      is_open = 'open'
    } else {
      is_open = 'close'
    }

    return this.singlePlaces.filter((j) => {
        return j.name.toLowerCase().match(this.search.toLowerCase();
    });
  }
}
Run Code Online (Sandbox Code Playgroud)

和我的标记:

methods: {
  addFavoritePlace(place_id) {
    axios.post('/api/add-favorite-place', { place_id: place_id })
      .then(response => {
        // I need here force command.
      });
  },
},

computed: {
  filteredPlaces: function () { …
Run Code Online (Sandbox Code Playgroud)

vue.js vuejs2

5
推荐指数
2
解决办法
3043
查看次数

标签 统计

vue.js ×1

vuejs2 ×1