添加自动加载开关,是的分页加载器不自动加载数据,而是可以通过更新默认参数后,再执行,避免了mixins导致先执行导致的接收不到this.formedId的传参
This commit is contained in:
parent
e26975588b
commit
7b6863f3f1
|
|
@ -5,6 +5,7 @@
|
||||||
* @param {Object} options.defaultParams - 默认查询参数
|
* @param {Object} options.defaultParams - 默认查询参数
|
||||||
* @param {string} options.mode - 分页模式:'loadMore' 或 'pager'
|
* @param {string} options.mode - 分页模式:'loadMore' 或 'pager'
|
||||||
* @param {number} options.pageSize - 每页数量
|
* @param {number} options.pageSize - 每页数量
|
||||||
|
* @param {boolean} options.autoLoad - 是否在创建时自动加载数据,默认为true
|
||||||
* @returns {Object} Vue组件选项对象
|
* @returns {Object} Vue组件选项对象
|
||||||
*/
|
*/
|
||||||
export function createPagination(options = {}) {
|
export function createPagination(options = {}) {
|
||||||
|
|
@ -13,6 +14,7 @@ export function createPagination(options = {}) {
|
||||||
defaultParams = {},
|
defaultParams = {},
|
||||||
mode = "loadMore",
|
mode = "loadMore",
|
||||||
pageSize = 10,
|
pageSize = 10,
|
||||||
|
autoLoad = true, // 新增参数,控制是否自动加载
|
||||||
} = options;
|
} = options;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
@ -207,8 +209,10 @@ export function createPagination(options = {}) {
|
||||||
},
|
},
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
// 初始化时加载第一页数据
|
// 只有在 autoLoad 为 true 时才自动加载数据
|
||||||
this.winB_GetList();
|
if (autoLoad) {
|
||||||
|
this.winB_GetList();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,6 +153,7 @@ export default {
|
||||||
fetchData: getProjectSchedule,
|
fetchData: getProjectSchedule,
|
||||||
mode: "loadMore",
|
mode: "loadMore",
|
||||||
pageSize: 2,
|
pageSize: 2,
|
||||||
|
autoLoad: false, // 设置为 false,不自动加载
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
data() {
|
data() {
|
||||||
|
|
@ -165,6 +166,7 @@ export default {
|
||||||
selectedIndex: 0,
|
selectedIndex: 0,
|
||||||
customAmount: "",
|
customAmount: "",
|
||||||
payAmount: "",
|
payAmount: "",
|
||||||
|
formedId: null, // 添加 formedId 到 data 中
|
||||||
|
|
||||||
projectDetails: {
|
projectDetails: {
|
||||||
// createBy: null,
|
// createBy: null,
|
||||||
|
|
@ -207,7 +209,7 @@ export default {
|
||||||
// templeId: "12",
|
// templeId: "12",
|
||||||
// title: "施工情况01232",
|
// title: "施工情况01232",
|
||||||
// content:
|
// content:
|
||||||
// "<p>施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02...</p>",
|
// "<p>施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02施工情况02...</p>",
|
||||||
// status: "1",
|
// status: "1",
|
||||||
// templeName: "寒山寺",
|
// templeName: "寒山寺",
|
||||||
// createTime: "2025-07-09 13:50:57",
|
// createTime: "2025-07-09 13:50:57",
|
||||||
|
|
@ -231,10 +233,11 @@ export default {
|
||||||
if (options) {
|
if (options) {
|
||||||
console.log("接收到的参数:", options.formedId);
|
console.log("接收到的参数:", options.formedId);
|
||||||
this.formedId = options.formedId;
|
this.formedId = options.formedId;
|
||||||
|
// 更新参数并首次执行数据加载
|
||||||
|
this.winB_UpdateParams({ formedId: this.formedId });
|
||||||
}
|
}
|
||||||
// 页面加载时获取数据
|
// 页面加载时获取数据
|
||||||
this.loadPageData();
|
this.loadPageData();
|
||||||
this.winB_GetList();
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
// 加载页面数据
|
// 加载页面数据
|
||||||
|
|
|
||||||
|
|
@ -17,18 +17,18 @@ import {
|
||||||
const ENV_CONFIG = {
|
const ENV_CONFIG = {
|
||||||
develop: {
|
develop: {
|
||||||
// 开发环境
|
// 开发环境
|
||||||
baseUrl: "http://192.168.2.58:4501",
|
baseUrl: "http://192.168.2.58:4502",
|
||||||
//baseUrl: "https://testlu.chuangtewl.com/prod-api",
|
//baseUrl: "https://testlu.chuangtewl.com/prod-api",
|
||||||
appId: 1,
|
appId: 1,
|
||||||
},
|
},
|
||||||
trial: {
|
trial: {
|
||||||
// 体验版
|
// 体验版
|
||||||
baseUrl: "http://192.168.2.58:4501",
|
baseUrl: "http://192.168.2.58:4502",
|
||||||
appId: 1,
|
appId: 1,
|
||||||
},
|
},
|
||||||
release: {
|
release: {
|
||||||
// 正式版
|
// 正式版
|
||||||
baseUrl: "http://192.168.2.58:4501",
|
baseUrl: "http://192.168.2.58:4502",
|
||||||
appId: 1,
|
appId: 1,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user