1. 程式人生 > >vue element傳的值報_self.$scopedSlots.default is not a function,element元件在一個vue元件中重複使用

vue element傳的值報_self.$scopedSlots.default is not a function,element元件在一個vue元件中重複使用

<template> <div> <h1 style="margin:0;padding:10px 10px;font-size:20px;color:#333333;background-color:rgb(243,243,243);">建立滿贈促銷活動</h1> <div class="lit"> <template> <el-tabs v-model="activeName2" type="card" @tab-click="handleClick">
<el-tab-pane label="單品促銷" name="first"></el-tab-pane> <el-tab-pane label="類目促銷" name="second"></el-tab-pane> <el-tab-pane label="品牌促銷" name="third"></el-tab-pane> </el-tabs> <el-form :model="ruleForm" :rules
="rules" ref="ruleForm" label-width="120px" class="demo-ruleForm"> <el-form-item label="促銷名稱:" prop="name"> <el-input style="width:50%;" v-model="ruleForm.name"></el-input> </el-form-item> <el-form-item label="促銷規則:"
required> <el-radio v-model="ruleForm.radio" label="1">備選項</el-radio> <el-radio v-model="ruleForm.radio" label="2">備選項</el-radio> </el-form-item> <el-form-item > <div v-if="ruleForm.radio==1" style="display:inline-block;"> 滿<el-input style="width:80px;margin:0 10px;" v-model="ruleForm.number"></el-input></div> <div v-else-if="ruleForm.radio==2" style="display:inline-block;"> 滿<el-input style="width:80px;margin:0 10px;" v-model="ruleForm.number"></el-input></div> <el-button style="margin:0 10px;" type="primary" @click="addshop">新增贈品</el-button> </el-form-item> <el-form-item> <el-table :data="this.$store.state.mad.addgoodslist" key='aTable' style="width: 100%"> <el-table-column label="商品圖片" width="180"> <template slot-scope="scope"> <img :src="scope.row.dataPic" class="imagelit" alt=""> </template> </el-table-column> <el-table-column label="商品編號" prop="goodsCode" width="180"> </el-table-column> <el-table-column label="商品名稱" prop="goodsName" width="180"> </el-table-column> <el-table-column label="操作"> <template slot-scope="scope"> <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">刪除</el-button> </template> </el-table-column> </el-table> </el-form-item> <el-form-item v-if="command=='first'" label="選擇貨品:" required> <el-button style="margin:0 10px;" type="primary" @click="goodssubmit">選擇參加促銷的貨品</el-button> <el-checkbox v-model="ruleForm.checked1">全場促銷(全場促銷可不指定貨品)</el-checkbox> </el-form-item> <el-form-item v-else-if="command=='second'" label="選擇類目:" required> <el-button style="margin:0 10px;" @click="categorysubmit" type="primary">選擇參加促銷的類目</el-button> <el-checkbox v-model="ruleForm.checked2">全場促銷(全場促銷可不指定貨品)</el-checkbox> </el-form-item> <el-form-item v-else-if="command=='third'" label="選擇品牌:" required> <el-button style="margin:0 10px;" @click="brandsubmit" type="primary">選擇參加促銷的品牌</el-button> <el-checkbox v-model="ruleForm.checked3">全場促銷(全場促銷可不指定貨品)</el-checkbox> </el-form-item> <el-form-item v-if="command=='first'" label="已選擇貨品:" required> <el-table :data="this.$store.state.mad.goodslist" key='firstTable' style="width:800"> <el-table-column label="商品圖片" width="180"> <template slot-scope="scope"> <img :src="scope.row.dataPic" class="imagelit" alt=""> </template> </el-table-column> <el-table-column label="商品編號" prop="goodsCode" width="180"> </el-table-column> <el-table-column label="商品名稱" prop="goodseName" width="180"> </el-table-column> <el-table-column label="操作"> <template slot-scope="scope"> <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">刪除</el-button> </template> </el-table-column> </el-table> </el-form-item> <el-form-item v-else-if="command=='second'" label="已選擇類目:" required> <div>123</div> <template> <el-table :data="this.$store.state.mad.categorylist" key='secondTable' style="width: 100%"> <el-table-column label="分類編號" prop="classtreeCode" width="180"> </el-table-column> <el-table-column label="" prop="" width="180"> </el-table-column> <el-table-column label="分類名稱" prop="classtreeName" width="180"> </el-table-column> <el-table-column label="操作"> <template slot-scope="scope"> <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">刪除</el-button> </template> </el-table-column> </el-table> </template> </el-form-item> <el-form-item v-else-if="command=='third'" label="已選擇品牌:" required> <el-table :data="this.$store.state.mad.brandslist" key='thirdTable' style="width: 100%"> <el-table-column label="品牌編號" prop="brandCode" width="180"> </el-table-column> <el-table-column width="180"> </el-table-column> <el-table-column label="品牌名稱" prop="brandName" width="180"> </el-table-column> <el-table-column label="操作"> <template slot-scope="scope"> <el-button size="mini" type="danger" @click="handleDelete(scope.$index, scope.row)">刪除</el-button> </template> </el-table-column> </el-table>
</el-form-item> <el-form-item label="開始時間:" required> <el-date-picker v-model="ruleForm.value1" type="datetime" prop="date1" placeholder="選擇開始時間"> </el-date-picker> </el-form-item> <el-form-item label="結束時間:" required> <el-date-picker v-model="ruleForm.value2" type="datetime" prop="date2" placeholder="選擇結束時間"> </el-date-picker> </el-form-item> <el-form-item label="活動站點" > <el-checkbox v-model="ruleForm.checkeds">WAP</el-checkbox> </el-form-item> <el-form-item label="促銷描述" prop="type"> <!-- //富文字選擇器 --> </el-form-item> <el-form-item> <el-button type="primary" @click="submitForm('ruleForm')">立即建立</el-button> <el-button @click="resetForm('ruleForm')">重置</el-button> </el-form-item> </el-form> </template> <div> <!-- 新增贈品 --> <addshop></addshop> <!-- 選擇貨品 --> <shoppinggoods></shoppinggoods> <!-- 選擇類目 --> <shoppingcategory></shoppingcategory> <!-- 選擇品牌 --> <shoppingbrand></shoppingbrand> </div> </div> </div></template><script>import shoppinggoods from "./shoppinggoods";import shoppingcategory from "./shoppingcategory";import shoppingbrand from "./shoppingbrand";import addshop from "./addshop"; export default { components: { shoppinggoods, shoppingbrand, shoppingcategory, addshop }, data() { return { tableData: [{ date: '2016-05-02', name: '王小虎', address: '上海市普陀區金沙江路 1518 弄' }, { date: '2016-05-04', name: '王小虎', address: '上海市普陀區金沙江路 1517 弄' }, { date: '2016-05-01', name: '王小虎', address: '上海市普陀區金沙江路 1519 弄' }, { date: '2016-05-03', name: '王小虎', address: '上海市普陀區金沙江路 1516 弄' }], activeName2: 'first', command:"first", ruleForm: { name: '', value1:"", value2:"", region: '', date1: '', date2: '', delivery: false, type: [], resource: '', desc: '', radio:"1", checked1:false, checked2:false, checked3:false, checkeds:true//活動站點 }, rules: { name: [ { required: true, message: '請輸入活動名稱', trigger: 'blur' }, { min: 3, max: 5, message: '長度在 3 到 5 個字元', trigger: 'blur' } ], date1: [ { type: 'date', required: true, message: '請選擇開始時間', trigger: 'change' } ], date2: [ { type: 'date', required: true, message: '請選擇結束時間', trigger: 'change' } ], type: [ { type: 'array', required: true, message: '請至少選擇一個活動性質', trigger: 'change' } ], resource: [ { required: true, message: '請選擇活動資源', trigger: 'change' } ], desc: [ { required: true, message: '請填寫活動形式', trigger: 'blur' } ] } }; }, methods: { addshop(){//新增贈品 this.$store.commit('addgoods',true); console.log(1); console.log(this.$store.state.mad.addgoodsdialogTableVisible); }, handleClick(tab, event) {//頭部點選切換 console.log(tab.name, event); this.command=tab.name; console.log("error"); }, submitForm(formName) {//立即建立 this.$refs[formName].validate((valid) => { if (valid) { alert('submit!'); } else { console.log('error submit!!'); return false; } }); }, resetForm(formName) {//重置 this.$refs[formName].resetFields(); }, handleDelete(index, row) {//刪除 console.log(index, row); }, goodssubmit(){//開啟促銷貨品列表 this.$store.commit('goodschange',true); console.log(1); console.log(this.$store.state.mad.goodsdialogTableVisible); }, categorysubmit(){//開啟促銷類目列表 this.$store.commit('categorychange',true); console.log(2); console.log(this.$store.state.mad.categorydialogTableVisible); }, brandsubmit(){//開啟促銷品牌列表 this.$store.commit('brandchange',true); console.log(3); console.log(this.$store.state.mad.branddialogTableVisible); } } };</script><style scoped> .lit{ padding:10px; } .imagelit{ width:100px; height:100px; }</style>本文主要設定到多個el-table報錯_self.$scopedSlots.default is not a function,此時的解決辦法是設定key=""

相關推薦

vue element_self.$scopedSlots.default is not a function,element元件一個vue元件重複使用

<template> <div> <h1 style="margin:0;padding:10px 10px;font-size:20px;color:#333333;background-color:rgb(243,243,243);">建立滿贈促銷

vue element el-table _self.$scopedSlots.default is not a function

點選修改的時候,頁面的預算佔比呈現輸入框的形式,確認修改之後,資料改變,也要把輸入框關閉,變成文字形式。這裡需要改變table的el-table-column值     1 <el-table 2 :data="newlist" 3

vue開發問題-解決方法】(四)vue Element UI使用.$scopedSlots.default is not a function

判斷 元素 技術分享 error: class 解決 nbsp AR peer 當使用elementUI中v-if來判斷顯示元素時,會報錯。 vue.js:600 [Vue warn]: Error in render: "TypeError: l.$scopedSl

Vue表格複用,錯"TypeError: _self.$scopedSlots.default is not a function"

場景:單頁面做可切換的多報表展示 如圖:每個報表戰術展示不同的資料項,需要隨select的切換,複用對應的table 這樣寫會報錯,並且切換後的table選項沒有達到預期效果 <el-main style="padding:10px;overflow-y:hidden"&g

vue】elementUI錯:_self.$scopedSlots.default is not a function

Vue 會盡可能高效地渲染元素,通常會複用已有元素而不是從頭開始渲染。 這樣也不總是符合實際需求,所以 Vue 為你提供了一種方式來表達“這兩個元素是完全獨立的,不要複用它們”。只需新增一個具有唯一值的 key 屬性即可。見詳情 錯誤程式碼 <!-- 程式碼塊1 --> <el-tab

Vue.js搭建路由錯 router.map is not a function

錯誤: 出現問題原因:2.0已經沒有map這個方法了,只有1.0相容該方法。 解決方法: (1)方法1:使用命令npm install [email protected]相容1.0版本vu

Error in render: "TypeError: _self.$scopedSlots.default is not a function"

今天在做專案中遇到了如上圖這樣一個問題,專案是Vue+element-ui。原因是table中用了多個v-if,解決方案有兩個: 1、用v-show代替v-if(個人推薦用第二種); 2、在v-if條件語句中加key作為區分就不會報錯了。 <el-table

記js錯: {(intermediate value)} is not a function at HTMLDocument.

使用立即執行函式的時候,chrome報這個錯誤; const url = {   users: "xxx" }  //沒有;導致報錯 (function () {   //程式碼 })() js用func()方式呼叫函式,函式的定義有: 函式宣告,匿名函式,函式表示式; 立即執行函式

瀏覽器錯obj.attachEvent is not a function

書上講主流瀏覽器的事件模型分為IE事件模型和標準事件模型,那麼如何區分,IE事件模型中window物件提供了event屬性 儲存當前事件;標準事件模型中,事件物件是在事件觸發時生成,作為引數傳遞給事件處理程式,是區域性的。具體程式碼區分為 if (window.event) {obj.attac

使用vue時Module build failed: TypeError: this._init is not a function錯誤的解決方法

錯誤描述 整個專案目錄結構如下: src hello.vue main.js index.html package.json webpack.config.js package.json { "name": "test-typeof-vue",

videogular2 在ionic專案裡錯(rxjs_1.fromEvent is not a function)

這種是videogular2 跟ionic版本相容問題 換個videogular2版本試試 把原來版本去掉  自己手動安裝   npm install [email protected]

ajax返回String型別導致的flowplayer錯p.replace is not a function問題

今天用flowplayer拉流遇到了一個比較奇葩的問題,大致思路是js根據頁面的名稱採用ajax從後臺獲取號碼,然後用號碼建立任務輸出rtmp流,flowplayer進行播放,但是flowplayer初始化的時候報了個p.replace is not a function的

antd的表格拖拽排序, 錯:React.createContext is not a function

在使用 antd的表格拖拽排序功能時,  報錯: React.createContext is not a function 分析原因: 解決辦法: 1. 升級antd的版本          //下載固定版本 npm報錯,不指定版本OK。 2.  升

錯 _react3.default.createClass is not a function

component point create sla contents 新版本 body values origin 這個是因為react最新版本拋棄使用了createClass這個函數,這個也是為了配合ES6 。這種情況下會報錯 var Popover = Reac

vue開發問題-解決方法】(四)vue Element UI 日期選擇器獲取日期格式問題 t.getTime is not a function

format PE man UNC cti bubuko 圖片 orm ID 現有一表單需要填寫日期,采用了elementUI中日期選擇器,但是獲取到的數據格式是 Mon Jun 18 2018 00:00:00 GMT+0800 (中國標準時間) 而我需要的數

Combobox錯:row[opts.textField].toLowerCase is not a function

light peer mem div clas erro sea error () 使用easyui框架加載combobox。 html頁面: <span class="search_item">   <span class="item_text">

js錯 Uncaught TypeError: xxxx.each is not a function

each err typeerror span xxx list 報錯 pan 使用 在處理ajax返回的json數組時錯誤的使用了 list.each(function(){ }); 實際上當遍歷json數組是應該使用

TypeError: value.getTime is not a function (elementUI錯轉載 )

"TypeError: value.getTime is not a function" 2018年07月02日 16:41:24 leeleejoker 閱讀數:2091 標籤: vueelementUI報錯d

vue *** is not a function問題解決

最近剛開始研究vue框架,之前一直沒用過前端框架,雖然功能強大,但是早就知道在應用起來這裡面坑很多,果然前進的路上坑坑窪窪的。 在瞭解了一些基本功能後就拿著之前做過的一個普通H5結構的老專案做移植以便練習,很快就遇到了一個很蛋疼的問題,很多基於J

NodeJS | 連線mongodb資料庫成功之後db.collection is not a function錯誤解決辦法(四)

在nodejs操作mongodb顯示資料庫連線成功之後突然報了db.collection is not a function錯誤,引起這個錯誤的原因是nodejs獲取資料庫表的API寫法不對。(正如NodeJS | 入門篇 (一)提到的,不同版本的API,使用規範有差別)。修改方式如下: var