您的位置:首页 > 游戏 > 手游 > 泉州企业制作网站_门户网站开发公司平台_长沙 建站优化_友链交换网站源码

泉州企业制作网站_门户网站开发公司平台_长沙 建站优化_友链交换网站源码

2024/9/22 6:45:16 来源:https://blog.csdn.net/qq_37860634/article/details/142325477  浏览:    关键词:泉州企业制作网站_门户网站开发公司平台_长沙 建站优化_友链交换网站源码
泉州企业制作网站_门户网站开发公司平台_长沙 建站优化_友链交换网站源码

 

<template><div :class="$options.name" class="sgDevTool"><sgHead /><div class="sg-container"><div class="sg-start"><div style="margin-bottom: 10px">调用接口方法定义列表</div><el-inputstyle="margin-bottom: 10px"ref="textareaValue1"type="textarea":placeholder="`请粘贴sf.js中定义的调用方法代码片段(含注释内容)`"v-model="textareaValue1"show-word-limit/><el-button type="primary" @click="createResult">运行</el-button></div><div class="sg-center">→</div><div class="sg-end"><ouputTextarea ref="ouputTextarea" v-model="textareaValue2" /></div></div></div>
</template><script>
import sgHead from "@/vue/components/sgHead";
import ouputTextarea from "@/vue/components/ouputTextarea";
export default {name: "sgCreateCallAPIFunction",components: {sgHead,ouputTextarea,},data() {return {textareaValue1: localStorage[`sgDevTool/leftTextArea`],textareaValue2: "",};},watch: {textareaValue1(newValue, oldValue) {newValue && this.createResult(newValue);localStorage[`sgDevTool/leftTextArea`] = newValue;},},created() {},methods: {createResult(d) {if (this.textareaValue1.includes("//")) {let texts = this.$g.getMultiLineTexts(this.textareaValue1);let apis = [];texts.forEach((v, i) => {if (v.includes(`_this)`)) {apis.push({label: texts[i - 1],functionName: v.split("({")[0],params: v.split("({")[1].split("}")[0].split(",").map((v) => {v = v.trim();if (v === "cb") {return `cb: (d) => { //回调函数
},`;} else {return v;}}),});}});let r = apis.map((v) => `${v.label}
this.$f.${v.functionName}({${v.params.join(": ,\n")}
},this);`);this.textareaValue2 = r.join("\n\n");this.$refs.ouputTextarea.copyResult(); //自动复制生成结果} else {return this.$message.error(this.$refs.textareaValue1.$attrs.placeholder);}},},
};
</script><style lang="scss" scoped>
@import "~@/css/sgDevTool";
</style>

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com