vue下axios提交数据到php后台并存入mysql,取出json格式的数据时带双引号怎么解决?

1、vue的offer值设定如下:

offer: {
            isshow:false,
            sum_total_price:0,
            sum_discount:0,
            sum_price:0,
            children:[]    
        }

2、vue下axios提交代码如下:

let postData={
                offer:vm.offer
            }

axios.post("{:url('api/plan/save')}",Qs.stringify(postData))
            .then(function (response) {
                console.log(response);
            })
            .catch(function (error) {
                console.log(error);
            });

3、php接收后存入mysql,接收时打印如下:

'offer' => string '{"isshow":"false","sum_total_price":"0","sum_discount":"0","sum_price":"0"}' (length=75)

4、php从mysql读取并输入到模板中去,代码如下:

'offer' => string '{"isshow": "false", "sum_price": "0", "sum_discount": "0", "sum_total_price": "0"}' (length=82)

问题:原本offer的isshow应该是布尔型的;
现在从mysql取出后,加了双引号,变成字符串的;
isshow原本是在vue下控制div元素的显示与隐藏;
现在实现不了这个效果了;
针对这种双引号的问题,应该如何去解决???


GCT1015
浏览 995回答 0
0回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Vue.js