鍍金池/ 問答/ HTML問答
不討囍 回答

這需要你自定義toolbar。

 editorOption: {
                    modules: {
                        syntax: {
                            highlight: text => hljs.highlightAuto(text).value
                        },
                        toolbar: [
                            ['bold', 'italic', 'underline', 'strike'],        // toggled buttons
                            ['blockquote', 'code-block'],

                            [{'header': 1}, {'header': 2}],               // custom button values
                            [{'list': 'ordered'}, {'list': 'bullet'}],
                            [{'script': 'sub'}, {'script': 'super'}],      // superscript/subscript
                            [{'indent': '-1'}, {'indent': '+1'}],          // outdent/indent
                            [{'direction': 'rtl'}],                         // text direction

                            [{'size': ['small', false, 'large', 'huge']}],  // custom dropdown
                            [{'header': [1, 2, 3, 4, 5, 6, false]}],

                            [{'color': []}, {'background': []}],          // dropdown with defaults from theme
                            [{'font': []}],
                            [{'align': []}],
                            ['link', 'image', 'video', 'formula']//去除video即可
                        ]
                    },
                    placeholder: '編輯內(nèi)容...'
                }
青黛色 回答

1.在html里

script type="text/javascript" src="%PUBLIC_URL%/taolin.js"></script>

2.在webpack里配置:

output: {
    .....
    publicPath: publicPath,
    .....
  },

3.引入HtmlWebpackPlugin插件

哎呦喂 回答

datazoom有start和end,分別指定最小和最大的初始值

撿肥皂 回答

通過babel轉(zhuǎn)義的代碼看出來應(yīng)該是原型繼承


class A {
  constructor(a) {
    this.a = a;
  }
  getA() {
    console.log(a)
  }
}

class B extends A {
  constructor(b) {
    super()
    this.b = b;
  }
}

轉(zhuǎn)義后

"use strict";

var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();

function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }

function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }

function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

var A = function () {
  function A(a) {
    _classCallCheck(this, A);

    this.a = a;
  }

  _createClass(A, [{
    key: "getA",
    value: function getA() {
      console.log(a);
    }
  }]);

  return A;
}();

var B = function (_A) {
  _inherits(B, _A);

  function B(b) {
    _classCallCheck(this, B);

    var _this = _possibleConstructorReturn(this, (B.__proto__ || Object.getPrototypeOf(B)).call(this));

    _this.b = b;
    return _this;
  }

  return B;
}(A);
初念 回答

用cnpm安裝即可,問題解決

雅痞 回答

new Date()是個(gè)對象
startTime.setDate(startTime.getDate() + 1)這一步操作會修改掉this.searchTime[0]的值。

笑浮塵 回答

建議你打印一下response看一下:console.log(response);
你會發(fā)現(xiàn)兩者的區(qū)別,其實(shí)這也很好理解,每個(gè)插件或者每個(gè)框架都是自己封裝的接口,自己定義的返回體及返回內(nèi)容及其格式,就像自己定義變量似的,怎么定都是自己來定,能達(dá)到效果,不占用保留字就行。

心夠野 回答
document.forms[0].submit()

試一下

浪婳 回答

你已經(jīng)拿到了vue的包了,所以直接npm install, 等待安裝完成即可; vue init webpack name 是新建一個(gè)項(xiàng)目

離人歸 回答

禁止擴(kuò)展(不能添加新屬性):

Object.preventExtensions

密封對象(不能添加新屬性,不能刪除已有屬性):

Object.seal

凍結(jié)對象(不能添加新屬性,不能修改已有屬性,不能刪除已有屬性)

Object.freeze

提供一種思路:

{
  width: 100%;
  padding-top: 100%;
}
大濕胸 回答

把 xhr 封裝進(jìn)去 proise 裡面
然後用 async / await
就可以讓你照著順序執(zhí)行
greasemonkey/gm/xhr.ts

然後可以額外偽裝成瀏覽器的 XMLHttpRequest 讓 jquery ajax 調(diào)用

greasemonkey/web/xhr.ts

挽歌 回答

前端可以先通過API接口獲取加密字符串,服務(wù)可以把當(dāng)前登錄的用戶信息緩存起來,后續(xù)前臺的API請求都必須攜帶此串。
圖片描述
當(dāng)websocket建立連接時(shí),發(fā)送加密串,服務(wù)端進(jìn)行鑒權(quán)!

圖片描述
圖片描述

笨尐豬 回答

我們也使用springboot, 怎么沒發(fā)現(xiàn)你的這個(gè)問題呀?

玄鳥 回答

存成pickle文件再去讀取沒有你想像中的速度快
如果數(shù)據(jù)量不大,直接生成json對象放到代碼里

鐧簞噯 回答

addCart的邏輯有問題。。判斷是否有商品,有就更新數(shù)量,沒有就添加商品。代碼大概如下:

// cartList的結(jié)構(gòu)是這樣:
//  [{
//      name:"橙汁",
//      count:1
//  },{
//     name:"雪碧",
//     count:1
// }]
addCart(newFood) {
    //判斷是否購物車中已經(jīng)有商品,如果有就增加數(shù)量,反之加入這個(gè)商品
    let foodIndex = this.cartList.findIndex(food => food.name == newFood);
    //foodIndex為-1表示不存在 ,要加入商品
    if (foodIndex === -1) {
        cartList.push({
            name: newFood,
            count: 1
        })
     //foodIndex存在 ,更新數(shù)據(jù)
    } else {
        cartList[foodIndex].count++
    }
}

同樣你刪除商品時(shí),如果刪除后數(shù)量為0,就從購物車中移除。
ps: 命令規(guī)范點(diǎn)啊,carList我改成cartList

厭遇 回答

樓主后來解決了嗎?和你遇到一樣的問題.