40 lines
960 B
JavaScript
40 lines
960 B
JavaScript
|
"use strict";
|
||
|
const common_vendor = require("../../common/vendor.js");
|
||
|
const common_js_util = require("../../common/js/util.js");
|
||
|
const api_index = require("../../api/index.js");
|
||
|
const _sfc_main = {
|
||
|
__name: "article",
|
||
|
setup(__props) {
|
||
|
const wrap = common_vendor.reactive({});
|
||
|
const wrapId = common_vendor.ref("");
|
||
|
common_vendor.onLoad((option) => {
|
||
|
if (option.id)
|
||
|
wrapId.value = option.id;
|
||
|
getDetail();
|
||
|
});
|
||
|
function getDetail() {
|
||
|
api_index.api.getArticle({
|
||
|
query: {
|
||
|
id: wrapId.value
|
||
|
}
|
||
|
}).then((rs) => {
|
||
|
if (rs.code == 200) {
|
||
|
Object.assign(wrap, rs.data);
|
||
|
return;
|
||
|
}
|
||
|
common_js_util.util.alert({
|
||
|
content: rs.msg,
|
||
|
showCancel: false
|
||
|
});
|
||
|
});
|
||
|
}
|
||
|
return (_ctx, _cache) => {
|
||
|
return {
|
||
|
a: common_vendor.t(wrap.name),
|
||
|
b: wrap.context
|
||
|
};
|
||
|
};
|
||
|
}
|
||
|
};
|
||
|
wx.createPage(_sfc_main);
|