Commit b0e485a3 by luyt

fix:解决url参数丢失的问题

1 parent 1d6056ee
/**
* 获取url参数 get
*/
function getQueryVariable(variable) {
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split("=");
if (pair[0] == variable) {
return pair[1];
}
}
return false;
}
export { getQueryVariable };
......@@ -103,12 +103,15 @@ export default {
onSubmit() {
this.$refs.ruleForm.validate((valid) => {
if (valid) {
const classify = sessionStorage.getItem("classify");
// const classify = sessionStorage.getItem("classify");
const pramas = {
...this.form,
classify,
// classify,
};
// console.log("pramas: " + JSON.stringify(pramas));
if (this.isNewAdd) {
//新增
this.api.project.create(pramas).then((res) => {
......
......@@ -120,6 +120,7 @@ const data = [
// },
];
import projectImgUrl from "@/assets/project.jpg";
// import { getQueryVariable } from "@/utils/index";
export default {
name: "Home",
data() {
......@@ -145,6 +146,7 @@ export default {
//设置 项目分类
setClassifyFn() {
const classify = this.$route.query.classify;
sessionStorage.setItem("classify", classify);
},
add() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!