You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
69 lines
1.0 KiB
69 lines
1.0 KiB
1 year ago
|
<template>
|
||
|
<view>
|
||
|
<d-search-log @onSearchNameApi="onSearchNameApi"></d-search-log>
|
||
|
<view>
|
||
|
<view class="serach-list" v-for="(data,i) in dishList" :key="i">
|
||
|
|
||
|
<view class="dish-item">
|
||
|
<image class="dish-image" :src="data[i].dish_src"></image>
|
||
|
</view>
|
||
|
|
||
|
</view>
|
||
|
</view>
|
||
|
</view>
|
||
|
</template>
|
||
|
|
||
|
<script>
|
||
|
import Vue from 'vue'
|
||
|
export default {
|
||
|
data() {
|
||
|
return {
|
||
|
dishList: [],
|
||
|
};
|
||
|
},
|
||
|
onLoad() {
|
||
|
|
||
|
},
|
||
|
methods: {
|
||
|
async onSearchNameApi(e) {
|
||
|
let that = this
|
||
|
let data = []
|
||
|
uniCloud.callFunction({
|
||
|
name: 'getDishes',
|
||
|
data: {
|
||
|
api: 'getByName',
|
||
|
dish_name: e
|
||
|
},
|
||
|
success: function(res) {
|
||
|
|
||
|
/*that.dishList.splice(0)
|
||
|
data = [res.result.data]
|
||
|
for (let i = 0; i < data.length; i++) {
|
||
|
Vue.set(that.dishList, i, data[i])
|
||
|
}*/
|
||
|
|
||
|
console.log(res)
|
||
|
}
|
||
|
})
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss">
|
||
|
.searchbox {
|
||
|
width: 500;
|
||
|
display: flex;
|
||
|
}
|
||
|
|
||
|
.search-list {
|
||
|
display: flex;
|
||
|
}
|
||
|
|
||
|
.dish_image {
|
||
|
width: 100rpx;
|
||
|
height: 70rpx;
|
||
|
}
|
||
|
</style>
|