提交 16962672 编写于 作者: d-u-a's avatar d-u-a

fix(unicloud-db组件): 支持 vue2 nvue

上级 e063fc5c
...@@ -49,6 +49,7 @@ const attrs = [ ...@@ -49,6 +49,7 @@ const attrs = [
export default { export default {
name: 'UniClouddb', name: 'UniClouddb',
// #ifdef VUE3
setup(props) { setup(props) {
// 单条记录时,使用shallowRef(仅支持赋值修改),列表时,采用ref(支持push等修改) // 单条记录时,使用shallowRef(仅支持赋值修改),列表时,采用ref(支持push等修改)
const dataListRef = props.getone ? shallowSsrRef(undefined) : ssrRef([]) const dataListRef = props.getone ? shallowSsrRef(undefined) : ssrRef([])
...@@ -67,6 +68,7 @@ export default { ...@@ -67,6 +68,7 @@ export default {
return this.loadData() return this.loadData()
} }
}, },
// #endif
props: { props: {
options: { options: {
type: [Object, Array], type: [Object, Array],
...@@ -163,6 +165,9 @@ export default { ...@@ -163,6 +165,9 @@ export default {
return { return {
loading: false, loading: false,
hasMore: false, hasMore: false,
// #ifndef VUE3
dataList: [],
// #endif
paginationInternal: {}, paginationInternal: {},
errorMessage: '' errorMessage: ''
} }
...@@ -174,6 +179,11 @@ export default { ...@@ -174,6 +179,11 @@ export default {
size: this.pageSize, size: this.pageSize,
count: 0 count: 0
} }
// #ifndef VUE3
if (this.getone) {
this.dataList = undefined
}
// #endif
this.$watch(() => { this.$watch(() => {
var al = [] var al = []
...@@ -233,11 +243,13 @@ export default { ...@@ -233,11 +243,13 @@ export default {
// #endif // #endif
}, },
// #ifndef VUE3
mounted() { mounted() {
// if (!this.manual && this.loadtime === loadMode.auto) { if (!this.manual && this.loadtime === loadMode.auto) {
// this.loadData() this.loadData()
// } }
}, },
// #endif
methods: { methods: {
loadData(args1, args2) { loadData(args1, args2) {
let callback = null let callback = null
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册