【发布时间】:2019-01-07 10:23:23
【问题描述】:
我现在在我的 webview 应用程序上使用 vue js 只是为了过滤用户搜索。在我在Samsung SM-G530H 上运行我的应用程序之前,一切都运行良好,我收到一条错误消息Uncaught SyntaxError: Unexpected token (,我检查了一切正确,它可以在除旧设备之外的其他设备上运行。请问如何让它在所有设备上兼容?
new Vue({
el: '#SearchVueContenPage',
data() {
return {
q: '',
total_result: 0,
searchProduct: null,
loading: false,
sort_filter: ``,
URL: ajax_appserver("public", "_api/searchProduct.php")
}
},
computed: {
search() {
if (!this.searchProduct) {
return []
}
if (!this.q) {
this.total_result = 0;
return this.searchProduct.recent.slice(0,4);
}
var query = this.q.toLowerCase();
var searchResult = this.searchProduct.result.filter(row => row.product_name.toLowerCase().includes(query) || row.business_name.toLowerCase().includes(query));
this.total_result = searchResult.length;
return searchResult;
}
},
mounted() {
this.loading = true;
this.fetchData().then(() => {
this.loading = false
});
},
methods: {
sortStatus: function(status) {
this.sort_filter = status;
},
async fetchData() {
ajax_fetch(this.URL).then(json => {
this.searchProduct = json;
Vue.nextTick(function(){
//Store object in IndexDb
}.bind(this));
});
}
}
});
【问题讨论】:
标签: javascript vue.js compatibility