@repackel/repack-plus
Version:
A repackage of element-plus to help you build pages faster.
91 lines (88 loc) • 2.3 kB
JSON
{
"Generate repackel page": {
"prefix": "repackelPage",
"body": [
"<template>",
"\t\t<div class=\"cp-page ${1:pageName}\">",
"\t\t\t\t<rl-table :cfg=\"cfg\" ref=\"$1\"></rl-table>",
"\t\t</div>",
"</template>",
"",
"<script>",
"import { Table } from \"@repackel/repack\";",
"export default {",
"\tname: \"$1\",",
"\tcomponents: {",
"\t\t[Table.name]: Table",
"\t},",
"\tdata() {",
"\t\treturn {",
"\t\t\tcfg: {",
"\t\t\t\tactionAlign: \"right\",",
"\t\t\t\tactionList: [",
"\t\t\t\t\t{",
"\t\t\t\t\t\tname: \"Add\",",
"\t\t\t\t\t\tfn: () => this.addItem()",
"\t\t\t\t\t}",
"\t\t\t\t],",
"\t\t\t\tsearchCfg: {",
"\t\t\t\t\tqueryBtn: \"2\"",
"\t\t\t\t},",
"\t\t\t\tsearchList: [",
"\t\t\t\t\t{",
"\t\t\t\t\t\tname: \"Keyword\",",
"\t\t\t\t\t\ttype: \"input\",",
"\t\t\t\t\t\tkey: \"content\"",
"\t\t\t\t\t}",
"\t\t\t\t],",
"\t\t\t\tsearchFn: this.getList,",
"\t\t\t\ttableList: [",
"\t\t\t\t\t{",
"\t\t\t\t\t\tlabel: \"Title\",",
"\t\t\t\t\t\tprop: \"title\",",
"\t\t\t\t\t\tminWidth: \"180\"",
"\t\t\t\t\t},",
"\t\t\t\t\t{",
"\t\t\t\t\t\ttemp: true,",
"\t\t\t\t\t\tlabel: \"Action\",",
"\t\t\t\t\t\twidth: \"180\",",
"\t\t\t\t\t\tbuttonList: [",
"\t\t\t\t\t\t\t{",
"\t\t\t\t\t\t\t\ttext: \"Del\",",
"\t\t\t\t\t\t\t\tfn: row => this.rmItem(row.id)",
"\t\t\t\t\t\t\t}",
"\t\t\t\t\t\t]",
"\t\t\t\t\t}",
"\t\t\t\t],",
"\t\t\t}",
"\t\t};",
"\t},",
"\tmethods: {",
"\t\tgetList(p, reset) {",
"\t\t\tlet p2 = {",
"\t\t\t\t...p",
"\t\t\t};",
"\t\t\treturn new Promise((resolve, reject) => {",
"\t\t\t\tthis.$$req(\"/get/list\", {",
"\t\t\t\t\tmethod: \"GET\",",
"\t\t\t\t\tparams: p2",
"\t\t\t\t})",
"\t\t\t\t\t.then(res => {",
"\t\t\t\t\t\tresolve({",
"\t\t\t\t\t\t\tlist: res.rows,",
"\t\t\t\t\t\t\ttotal: res.total",
"\t\t\t\t\t\t});",
"\t\t\t\t\t})",
"\t\t\t\t\t.catch(e => reject(e));",
"\t\t\t});",
"\t\t},",
"\t\taddItem() {},",
"\t\trmItem() {}",
"\t}",
"};",
"</script>",
""
],
"description": "generate a page use repackel"
}
}