中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當(dāng)前位置: 首頁 > news >正文

天津做做網(wǎng)站公眾號(hào)運(yùn)營

天津做做網(wǎng)站,公眾號(hào)運(yùn)營,天津百度推廣排名優(yōu)化,在設(shè)計(jì)賺錢的網(wǎng)站菜鳥一直在糾結(jié)這個(gè)寫不寫,因?yàn)椴浑y,但是菜鳥老是容易忘記,雖然想想或者搜搜就可以馬上寫出來,但是感覺每次那樣就太麻煩了,不如一股做氣寫了算了,后面遇見別的就再來補(bǔ)充! 文章目錄 table 表格…

菜鳥一直在糾結(jié)這個(gè)寫不寫,因?yàn)椴浑y,但是菜鳥老是容易忘記,雖然想想或者搜搜就可以馬上寫出來,但是感覺每次那樣就太麻煩了,不如一股做氣寫了算了,后面遇見別的就再來補(bǔ)充!

文章目錄

  • table 表格自定義內(nèi)容
  • select 顯示的是value
  • upload 使用 —— 一個(gè)文件(多個(gè)文件可以借鑒)
  • el-dialog 使用
    • 一定要用一個(gè)參數(shù)接收 defineProps
    • 不要再 el-dialog 上加class
  • element plus 和 px2rem 不兼容
    • 錯(cuò)位的圖標(biāo)(element plus自己的bug)
    • 巨大的圖標(biāo)

table 表格自定義內(nèi)容

<el-table-column label="操作" width="230"><template #default="scope"><el-button type="primary" size="small">詳情</el-button><el-popconfirm :title="$t('deleteprompt')" @confirm="deleteEvent(scope.row)"><template #reference><el-button type="danger" size="small">刪除</el-button></template></el-popconfirm><el-button type="primary" size="small" :disabled="scope.row.status == 0">分享</el-button></template>
</el-table-column>

select 顯示的是value

之所以顯示為 value 就是因?yàn)?#xff0c;你 v-model 所給的值,和 el-option 的 value 不一致,最常見的就是 0 和 ’0‘ 了

upload 使用 —— 一個(gè)文件(多個(gè)文件可以借鑒)

el-upload 的 html 部分:

<el-upload class="upload-demo" ref="upload" action="#" :auto-upload="false" :limit="1" :on-change="onFun" :on-exceed="handleExceed" :on-remove="removeFun"><template #trigger><el-button type="primary">選擇文件</el-button></template><el-button class="uploadtext" type="success" @click="submitUpload"> 上傳 </el-button><span class="tip" @click="downloadFile('模板', downloadUrlArr[formdata.formType])"> 下載模板 </span><template #tip><div class="el-upload__tip text-red">* 只能上傳excel文件</div></template>
</el-upload>

upload 邏輯:

// 獲取el-upload元素,方便后面清空
const upload = ref();
// 提交使用
let fd = null;
// 上傳事件
function onFun(file) {if (file.name.indexOf(".xls") > 0 || file.name.indexOf(".xlsx") > 0 || file.name.indexOf(".xlsm") > 0) {fd = new FormData();fd.append("file", file.raw); //傳文件} else {upload.value.clearFiles();// eslint-disable-next-lineElMessage({message: "請(qǐng)選擇excel文件!",type: "error",});}
}
// 刪除文件事件
function removeFun() {upload.value.clearFiles();
}
// 提交第二個(gè)文件事件
const handleExceed = (files) => {// console.log(files);upload.value.clearFiles();const file = files[0];upload.value.handleStart(file);
};
// 提交事件 -》 這部分按邏輯自行更改
const submitUpload = () => {uploadFile(fd).then((res) => {if (res.code == 200) {console.log(res);} else {// eslint-disable-next-lineElMessage({message: res.message,type: "error",});}}).catch((err) => {console.log(err);});
};

下載邏輯:

這個(gè)就是菜鳥插一嘴想寫寫,因?yàn)橄螺d和請(qǐng)求接口的邏輯不太一樣,只需要訪問就行了,菜鳥有時(shí)候也容易忘記,所以這里記一下!

// 枚舉類型
const downloadUrl = localStorage.getItem("downloadUrl"); // 這個(gè)菜鳥在不同環(huán)境設(shè)置的值不同
const downloadUrlArr = [`${downloadUrl}/user/downloadExcel`];// 下載表單
function downloadFile(filename, url) {let a = document.createElement("a");a.style = "display: none"; // 創(chuàng)建一個(gè)隱藏的a標(biāo)簽a.download = filename;a.href = url;document.body.appendChild(a);a.click(); // 觸發(fā)a標(biāo)簽的click事件document.body.removeChild(a);
}

這里界面上調(diào)用的是數(shù)組,是因?yàn)榭赡懿恢挂粋€(gè)地址,菜鳥把地址列舉成為枚舉屬性了,可能不太好!!!

el-dialog 使用

菜鳥發(fā)現(xiàn)官網(wǎng)里面都是直接在一個(gè)文件里面使用,但是一般 el-dialog 都是在組件里面封裝的,所以菜鳥就自己試了一下,結(jié)果問題就來了,這里記錄一下!

vue2 使用 elementui dialog 的邏輯可以看看我的這篇博客:elementui 的 dialog 常用邏輯總結(jié), 現(xiàn)在發(fā)現(xiàn)寫得不太好,但是勉強(qiáng)可以看 (T——T)

vue3 的坑主要在于:vue3單向數(shù)據(jù)流,但是這個(gè) el-dialog 又要v-model綁定,所以就會(huì)報(bào)錯(cuò),但是好在發(fā)現(xiàn)官網(wǎng)還有一種綁定方式,那就是 modelvalue !!!

這里菜鳥就寫個(gè)簡單的例子:

父組件:

<script setup>
import Detail from "./components/detail.vue";// 詳情彈窗
let editshow = ref(false);
let detailencodedCode = ref("");
// 打開
const showDetail = (data) => {detailencodedCode.value = data.encodedCode;editshow.value = true;
};
// 關(guān)閉
function hideEdit() {editshow.value = false;
}
</script><el-table-column label="操作" width="230"><template #default="scope"><el-button type="primary" size="small" @click="showDetail(scope.row)">詳情</el-button></template>
</el-table-column><!-- 詳情彈窗 -->
<Detail v-if="editshow" :pwd="detailencodedCode" :dialogVisible="editshow" @closeEvent="hideEdit"></Detail>

dialog 組件:

<script setup>
import { ref } from "vue";
import { getShareDetail } from "../../../network/api.js";// eslint-disable-next-line
const props = defineProps({dialogVisible: {type: Boolean,default: false,},pwd: {type: String,default: "",},
});// eslint-disable-next-line
const emit = defineEmits(["closeEvent"]);// 關(guān)閉彈窗
function handleClose() {emit("closeEvent", false);
}
const dialogBox = ref()
function closeDialog() {dialogBox.value.resetFields();
}
</script><template><div><el-dialog title="詳情" ref="dialogBox" :modelValue="dialogVisible" :before-close="handleClose" @close="closeDialog"><p>暫無數(shù)據(jù)!</p><template #footer><div><el-button @click="handleClose">關(guān)閉</el-button></div></template></el-dialog></div>
</template>

注意 :
這里的組件封裝有兩個(gè)問題需要注意!

一定要用一個(gè)參數(shù)接收 defineProps

雖然在 template 里面可以直接使用 defineProps 里面的變量,比如:dialogVisible, 但是 js 里面是不能直接訪問的,會(huì)提示沒有定義,只能通過:props.pwd 訪問,當(dāng)然接收的變量名自己定義就行,不一定要是props !!!

不要再 el-dialog 上加class

如果你給 el-dialog 上加上了class,那個(gè)你將收獲一個(gè)警告:

Extraneous non-props attributes (class) were passed to component but could not be automatically inherited because component renders fragment or text root nodes.

element plus 和 px2rem 不兼容

如果你在 element plus 項(xiàng)目中引入了 px2rem,那么你可能喜提巨大的圖標(biāo)等!

錯(cuò)位的圖標(biāo)(element plus自己的bug)

解決辦法就是在 public 底下的 index.html 中加入:

/* 解決 element plus 樣式問題 */
.el-icon.el-message__closeBtn {position: absolute !important;
}

巨大的圖標(biāo)

解決辦法就是在既有 px2rem 又有用到 ElMessage 的界面上加上如下代碼:

.el-message-icon--error {font-size: 5px;
}
.el-message-icon--success {font-size: 5px;
}
.el-message-icon--info {font-size: 5px;
}

記住不要在 style 上加 scoped !!!

http://www.risenshineclean.com/news/45415.html

相關(guān)文章:

  • 免費(fèi)海報(bào)在線制作網(wǎng)站河南鄭州最新消息
  • 公司網(wǎng)站怎么更新維護(hù)搜外滴滴友鏈
  • 網(wǎng)站 框架網(wǎng)頁建設(shè)軟文的概念是什么
  • 招聘網(wǎng)站源碼下載色盲測試圖
  • 精品課程網(wǎng)站建設(shè)論文重慶網(wǎng)站seo技術(shù)
  • 本地網(wǎng)站建設(shè)電話線上營銷課程
  • 晉中網(wǎng)站開發(fā)關(guān)鍵詞智能優(yōu)化排名
  • 申請(qǐng)一個(gè)域名可以做多少網(wǎng)站廣東seo外包服務(wù)
  • 專業(yè)網(wǎng)站制作設(shè)計(jì)公司哪家好sem培訓(xùn)班
  • 淄博市臨淄區(qū)建設(shè)局網(wǎng)站哪些網(wǎng)站推廣不收費(fèi)
  • 濰坊專業(yè)空心活塞桿win10優(yōu)化大師有用嗎
  • 天長企業(yè)網(wǎng)站制作軟件開發(fā)公司有哪些
  • 網(wǎng)站被人做跳轉(zhuǎn)了民生熱點(diǎn)新聞
  • app開發(fā)和網(wǎng)站建設(shè)區(qū)別怎么注冊(cè)一個(gè)自己的網(wǎng)站
  • 怎么用電腦做網(wǎng)站寧波優(yōu)化系統(tǒng)
  • 校園網(wǎng)站建設(shè)的意義百度云官網(wǎng)登錄首頁
  • 深圳微信網(wǎng)站app拉新渠道
  • 做app網(wǎng)站制作上海牛巨微網(wǎng)絡(luò)科技有限公司
  • wordpress動(dòng)靜分離cdn深圳網(wǎng)站設(shè)計(jì)專業(yè)樂云seo
  • 石家莊學(xué)做網(wǎng)站建設(shè)培訓(xùn)學(xué)校百度關(guān)鍵詞優(yōu)化點(diǎn)擊 教程
  • 網(wǎng)站站內(nèi)鏈接奉化首頁的關(guān)鍵詞優(yōu)化
  • 鄭州專門做網(wǎng)站的公司seo百度關(guān)鍵字優(yōu)化
  • 畢業(yè)設(shè)計(jì)代做淘寶好還是網(wǎng)站好免費(fèi)注冊(cè)
  • 網(wǎng)絡(luò)公司+網(wǎng)站建設(shè)+小程序百度企業(yè)官網(wǎng)
  • 承接各類網(wǎng)站建設(shè)關(guān)鍵詞排名代發(fā)
  • 如何建立微網(wǎng)站詳細(xì)步驟廣東公司搜索seo哪家強(qiáng)
  • 佛山新網(wǎng)站制作怎么樣抖音優(yōu)化是什么意思
  • 安徽專業(yè)網(wǎng)站建設(shè)大全推薦寧波seo排名費(fèi)用
  • 公司網(wǎng)站服務(wù)器托管東莞網(wǎng)站排名推廣
  • 企業(yè)網(wǎng)站哪里可以做江西seo推廣方案