鍍金池/ 問(wèn)答/ HTML問(wèn)答
鐧簞噯 回答

報(bào)錯(cuò)信息說(shuō)的很明白,hash history (瀏覽器歷史的一種) 不能保存同一個(gè) path 兩次,找到你哪個(gè)地方用了 history.push() 方法,在此之前判斷 path 是否重復(fù),或者把 hash history 換成 browser history

笑浮塵 回答

1.你可以把方法抽像出來(lái)寫(xiě)成一個(gè)通用的方法,然后用E6的模塊方法導(dǎo)出和引入;
2.可以寫(xiě)成mixin,在各個(gè)vue組建里面通過(guò)mixin引用

菊外人 回答

onload,或者說(shuō)是load事件表示的是“加載已完成”,如果需要加載過(guò)程中進(jìn)行回調(diào),可能需要去了解下 document.readyState 吧。

初念 回答

兩者都可以,如果不是一個(gè)新頁(yè)面,可以直接創(chuàng)建一個(gè)組件,這個(gè)組件也可以是一個(gè)頁(yè)面,在個(gè)人中心頁(yè)引入這個(gè)組件,然后點(diǎn)擊的按鈕觸發(fā)這個(gè)組件顯示出來(lái)。如果你想做一個(gè)新頁(yè)面,在main注冊(cè)路由,然后點(diǎn)擊按鈕跳轉(zhuǎn)到這個(gè)路由

未命名 回答

react 不支持異步組件, 建議使用 react-loadable 這個(gè)組件.

import Loadable from 'react-loadable';

routes=[
    {
        path: '/app/ui/buttons',
        component: Loadable({
            loader: () => import('../components/buttons')
        })
    },
    {
        path: '/app/ui/icons',
        component: Loadable({
            loader: () => import('../components/icons')
        })
    }
]
入她眼 回答

state 和 mutations 放在一個(gè)文件中嗎?
你可以分開(kāi)寫(xiě) state.js

export default {
    wisNum: 0
}

mutations.js

export default {
    SET_WISH: (state, payload) => {
        state.wishNum = payload
    }
}

index.js中

import state from './state.js'
import mutations from './mutations.js'
export default new Vuex.Store({
    state, mutations
})

Vue組件中

this.$store.commit('SET_WISH', 12)

main.js中

import store from './store/index.js'
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>',
  store
})
愿如初 回答

你好,可以問(wèn)下怎么導(dǎo)出的表格嗎?我用saver導(dǎo)出表格,blob數(shù)據(jù)是 table.innerHTML 然后類(lèi)型是 excel的類(lèi)型 導(dǎo)出的文件 打開(kāi)時(shí)候會(huì)提示 打開(kāi)的文件名不正確或者文件類(lèi)型不匹配

涼心人 回答

受到 @ymsd 的啟發(fā), 用了下面的方式, 不過(guò)不是一個(gè)正則解決的, 但也達(dá)到了需求

 var str = '好好<img src="../../static/images/express/4.gif" alt="[em_4]">好研究研究這<img src="../../static/images/express/4.gif" alt="[em_4]">個(gè)方案真詳細(xì)<img src="../../static/images/express/4.gif" alt="[em_4]">1111'

 var temp = str.replace(/<img.*?(?!alt=".*?")(>)/g, (match) => {
   return match.replace(/<img.*?(alt="(.*?)")(>)/g, '$2')
 })

結(jié)果

好好[em_4]好研究研究這[em_4]個(gè)方案真詳細(xì)[em_4]1111
陪我終 回答
"010203".match(/\d{2}/g);

或者

"010203".split(/\B(?=(?:\d{2})+\b)/);

或者

"010203".split(/\B(?=0)/);
赱丅呿 回答

change 事件寫(xiě)在methods:{} 里面了嗎

凝雅 回答

設(shè)置個(gè)臨時(shí)數(shù)組,遍歷的時(shí)候遍歷這個(gè)臨時(shí)數(shù)組,不知這樣能否滿(mǎn)足你的需求。

<ul class="obvers_ul">
    <li class="pro_li" v-for="(item,index) in templist" v-show="fruitSearch" @click="exactContent(item)">
        {{item}}
    </li>
</ul>
search:function () {
        var cus_tname=$("#search_name").val();
        this.templist = [];
        for(var i=0;i<this.fruitList.length;i++){
            if(this.fruitList[i].indexOf(cus_tname)>=0){
                console.log(this.fruitList[i]+"符合的");
                this.templist.push(this.fruitList[i]);
            }else {
                console.log(this.fruitList[i]+"不符合的")
            }
        }            
    },
裸橙 回答

你在瀏覽器上提取是在渲染完畢的頁(yè)面上提取的,代碼里請(qǐng)求的結(jié)果是原始的response,你應(yīng)該在瀏覽器network里看對(duì)應(yīng)請(qǐng)求的原始response結(jié)果,根據(jù)這個(gè)結(jié)果來(lái)提取。

悶騷型 回答

element里面是有個(gè)filelist數(shù)組的,里面是包含你上傳的文件列表,你想要?jiǎng)h除同步,只需要在你自己push的數(shù)組里刪除之后,將filelist數(shù)組里面的對(duì)應(yīng)數(shù)據(jù)刪除就ok

鹿惑 回答

array = [array[1]] 最簡(jiǎn)單了

拮據(jù) 回答

webpack配置文件

var path=require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
var utils = require('./utils');         // 引入獲取文件路徑的函數(shù)
var ROOT = utils.fullPath('../');       // 獲取頂層文件的路徑
console.log(ROOT)
module.exports={
    entry:'./src/entry/main.js',
    output:{
        path: ROOT + '/dist',
        filename:'bundle.js'
    },
    loader: {
        rules: [{
            test: /\.js[x]?$/,
            loader: 'babel-loader',
            exclude: /node_modules/
        }]
    },
    resolve: {
        extensions: [".js", ".jsx"]
    },
    plugins: [new HtmlWebpackPlugin({
        title: 'mobx-demo222',
        template: './src/entry/index.html',
        inject: 'head'
    })]
}
夢(mèng)囈 回答

【破案】查出原因了,用的 scss標(biāo)簽 <style lang="scss" scoped>的scoped干擾了,去掉scoped,偽類(lèi)正常出現(xiàn)。而刪除 scoped屬性、可以以組件為單位、對(duì)樣式進(jìn)行id劃分:(以下為示例)

#xxx {
  .yyy {...}
  EE.zzz {...}
  ...
}