Browse Source

fix rm err

main
cobb 3 years ago
parent
commit
b3e4763f67
  1. 22
      src/components/HelloWorld.vue

22
src/components/HelloWorld.vue

@ -93,7 +93,6 @@ function toCamelCase(str) {
); );
} }
function titleCase(str) { function titleCase(str) {
const newStr = str.slice(0, 1).toUpperCase() + str.slice(1); const newStr = str.slice(0, 1).toUpperCase() + str.slice(1);
return newStr; return newStr;
@ -104,14 +103,13 @@ function lowerCase(str) {
return newStr; return newStr;
} }
// t_usert_ // t_usert_
function rmPrefix(str) { function rmPrefix(str) {
if (str.indexOf('_') > -1) {
var n = str.indexOf('_')
return str.slice(n+1, str.length)
if (str.indexOf("_") > -1) {
var n = str.indexOf("_");
return str.slice(n + 1, str.length);
} }
return str
return str;
} }
function typeMap(str) { function typeMap(str) {
@ -229,7 +227,7 @@ export default {
handleRouteOutput(v) { handleRouteOutput(v) {
const title = rmPrefix(v.title); const title = rmPrefix(v.title);
const tableName = toCamelCase(title); const tableName = toCamelCase(title);
const lowTableName = title
const lowTableName = title;
const Output = ` const Output = `
{ {
${lowTableName} := admin.Group("${lowTableName}") ${lowTableName} := admin.Group("${lowTableName}")
@ -244,7 +242,7 @@ export default {
handleJsApi(v) { handleJsApi(v) {
const title = rmPrefix(v.title); const title = rmPrefix(v.title);
const tableName = toCamelCase(title); const tableName = toCamelCase(title);
const lowTableName = title
const lowTableName = title;
const Output = ` const Output = `
import request from '@/utils/request'; import request from '@/utils/request';
export function get${tableName}(data) { export function get${tableName}(data) {
@ -462,7 +460,12 @@ export default {
oReq.open("POST", "/sql", false); // oReq.open("POST", "/sql", false); //
oReq.setRequestHeader("Content-type", "application/json"); oReq.setRequestHeader("Content-type", "application/json");
console.log(this.sqlinput); console.log(this.sqlinput);
oReq.send(JSON.stringify({ content: this.sqlinput, camel: !this.isUnderScoreCase })); //JSON
oReq.send(
JSON.stringify({
content: this.sqlinput,
camel: !this.isUnderScoreCase,
})
); //JSON
var result = oReq.responseText; // var result = oReq.responseText; //
return result; return result;
}, },
@ -757,4 +760,3 @@ export default {
}, },
}; };
</script> </script>
Loading…
Cancel
Save