Vue ? Element-UI? ???? ??? ? ?? ?? ??? ???? ??
Jul 22, 2023 pm 04:12 PMVue ? Element-UI? ???? ??? ? ?? ?? ??? ???? ??
???:
? ???? ??? ? ?? ?? ??? ????? ???? ?????. ? ????? Vue ? Element-UI? ???? ??? ? ?? ?? ??? ???? ??? ???? ?? ??? ?? ?? ????? ?????.
1. ?? ??
- Node.js ??
???? ?? Node.js? ???? ???. https://nodejs.org/? ???? ?? ??? ???? ??? ?????? ??? ? ????. - Vue CLI ??
Vue CLI? Vue ????? ??? ???? ?? ?????. ??? ??? ?? ?? ??? ???? Vue CLI? ?????.
npm install -g @vue/cli
- Create Vue ????
????? ?? ??? ???? ? Vue ????? ????.
vue create drag -sort-demo
????? ?? ?? ??? ???? ????? ??? ??? ?????.
- Element-UI ??
?? ??? Vue ???? ????? ???? ????? ?? ??? ???? Element-UI? ?????.
npm install element-ui
2. ?? ??
- Import Element -UI
Vue ????? ?? ?? src/main.js?? Element-UI? ???? ?? ??? ?????.
'vue'?? Vue ????;
'element-?? ElementUI ???? ui';
import 'element-ui /lib/theme-chalk/index.css';
Vue.use(ElementUI);
- ?? ???? ??
? ???? ?? src/comComponents? DragSortDemo.vue ??? ? ?? ?? ??? ???? ???????. DragSortDemo.vue ??? ???? ?? ??? ?????.
<div class="drag-sort-demo">
<el-collapse-transition>
<div v-for="item in list" :key="item.id" class="drag-item" :class="{ 'dragging': draggingId === item.id }" draggable="true" @dragstart="handleDragStart(item)" @dragend="handleDragEnd(item)">
{{ item.name }}
</div>
</el-collapse-transition>
</div>
<el-button type="primary" @click="handleSort">保存排序</el-button>
<script><br>??? {<br> ??? ???? () {</p><pre class='brush:php;toolbar:false;'>return { list: [ { id: 1, name: 'A' }, { id: 2, name: 'B' }, { id: 3, name: 'C' }, { id: 4, name: 'D' }, { id: 5, name: 'E' }, ], draggingId: null, };</pre><p>},<br> ???: {</p><pre class='brush:php;toolbar:false;'>handleDragStart(item) { this.draggingId = item.id; }, handleDragEnd() { this.draggingId = null; }, handleSort() { const sortedList = Array.from(this.$el.querySelectorAll('.drag-item')).map((el, index) => { const id = el.getAttribute('data-id'); const name = el.textContent; return { id, name, sort: index + 1 }; }); // 將排序后的列表保存到數(shù)據(jù)庫或發(fā)送給后端 },</pre><p>},<br>};<br></script>
?? ??>
.drag-sort-demo {
?????: flex;
flex-wrap : ??? ;
}
.drag-item {
??: 10px;
??: 10px 0;
???: #f5f5f5;
???: 1px ?? #ebebeb;
??: ??;
??: ?? ??? 0.3? ;
}
.drag-item.draging {
box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
}
??:
- In the ???, v-for ???? ???? ?? ??? ???? ??????. ?? ??? ???? ?? ??? ??? ?? ???? ??? ???? ? ???? ??? ??? ??????.
- ? ?? ??? draggable ??? ???? dragstart ? dragend ??? ???? ???? ?? ??? ?? ? ?? ???? ??????.
- handleSort ???? ??? ?? ??? ? ???? ??? ?? ???? ???? ????? ????.
- ?? ?? ??
src/App.vue ???? DragSortDemo ?? ??? ?????.
<drag-sort-demo></drag-sort-demo>
template> ;
<script><br>'./comComponents/DragSortDemo.vue'?? DragSortDemo ????;</p><p>?? {<br> ???? ????: {</p><pre class='brush:php;toolbar:false;'>DragSortDemo,</pre><p>},<br>};<br></script>
3. ?????. ????
????? ?? ??? ???? ????? ?????.
npm runserv
http://localhost:8080? ???? ??? ? ?? ?? ??? ?? ???? ?????. ?? ??? ????? ??? ????, ?? ?? ??? ???? ?? ??? ?????.
??:
? ??? ?? Vue? Element-UI? ???? ??? ? ?? ?? ??? ????? ??????. ?? ? ??? ?? ???? ???? ???? ???? ??? ??? ????? ????? ?? ??? ???? ? ????. ? ?? ?? ??? ????? ?? ??? ??? ??? ????.
? ??? Vue ? Element-UI? ???? ??? ? ?? ?? ??? ???? ??? ?? ?????. ??? ??? PHP ??? ????? ?? ?? ??? ?????!

? AI ??

Undress AI Tool
??? ???? ??

Undresser.AI Undress
???? ?? ??? ??? ?? AI ?? ?

AI Clothes Remover
???? ?? ???? ??? AI ?????.

Clothoff.io
AI ? ???

Video Face Swap
??? ??? AI ?? ?? ??? ???? ?? ???? ??? ?? ????!

?? ??

??? ??

???++7.3.1
???? ?? ?? ?? ???

SublimeText3 ??? ??
??? ??, ???? ?? ????.

???? 13.0.1 ???
??? PHP ?? ?? ??

???? CS6
??? ? ?? ??

SublimeText3 Mac ??
? ??? ?? ?? ?????(SublimeText3)

??? Python ? ?? ????? ????? ?? ??? ?????. 1. Django ?? Flask? ?? ??? ??? ??? ??????. 2. ??????? ???? sqlalchemy? ?? ORM? ??????. 3. ??? ??? ???? Vue ?? React? ??????. 4. ???? ???? Pytest ?? UnitTest? ??????. 5. ?? ????? ???? Docker ? Heroku ?? AWS? ?? ???? ??????. ??? ??? ?? ???? ???? ? ?? ????? ?? ? ? ????.

??? ?? ??? ???? ??? URL? ?? ??? ???? ????. Vuerouter ? Reactrouter? URL ??? ?? ?? ?? ??????? ?? ???? ??? ??? ?????. ?? ???? ??? ?????. 1. ?? ???, ?? ?? ??? ?? ?? ?? ??? ?????. 2. ?? ???, URL ?? ??? ?? ?? ?? ?? ??; 3. Route Guard, ?? ?? ??? ?? ??? ?? ?? ??.

??? transforminvue3aimedtosimplify handlingreactivedatabyautomicallytrackingandmaningreactivity withoutequiringmanualref () ?? valueusage.itsivingtoreduceboilerplateandimprovecodeReadabilitabledevariableletandsconstasmonclicallicallicallicallicallicallicallicallicallicallicallicalliceLerplateNclateMconsconclicallicallicallicallicallicallicallicallicalliceLerplateN

vue.js? ?? ?? ???? React ?? ?? ??? ??? ????. 1) vue.js? ??? ??? ?? API? ???? ?? React? JSX ? ?? ?? ??? ?????. 2) vue.js? ?? ? ???? ???? React? ??? ???? ?? DOM? ?????. 3) vue.js? ?? ???? ??? ???? ?? React? ? ?? ??? ??? ?????.

??? ? ??? invueAppsareprimally handledusingthevuei18nplugin.1.installvue-i18nvianpmoryarn.2.createlocalejsonfiles (? : en.json, es.json) fortranslationMessages.3

vue.js? ?? ????? ?? ? ? ?? .defineProperty? ?? ??? ?? ?? ?? ?????? ?????? ????. ???? ??? ????. 1. VUE.SET ???? ???? ?? ???? ?????. 2. ?? ??? ? ??????. 3. VUE? ? ?? ? ???? ??? ???? ??? ??????.

?? : keyAttributeWithv-forInvueisSenderferperferformanCanceAndCorrectBehavior.first, ithelpsVuetrackeachelementementEficiledullyBirtlyBirtlyDiffingAlgorithMtoIndifyandUpdateOnlyWhat'Snecessary.second, itpreservescomponents, ensuri

VUE? ?? ?? ? ??? ?? ??? ??? ????? ?? : 1. V-Once ???? ???? ?? ???? ???? ???? ????? ????. 2. ?? ???? ???? Vue-Virtual-Scroller ????? ??? ?? ??? ??? ?? ? ??????. 3. ?? ???? ??? ?? Keep-Alive ?? V-Once? ?? ?? ?? ??; 4. ?? ? ?? ? ???? ???? ?? ? ??? ????? ? ??? ??? ????. 5. V-FOR?? ?? ? ??, ???? ??? ??? ??? ?? ?? ??? ???? ?? ??? ?? ? ?? ??? ?????. ??? ??? ?? ???? ????? ???? ? ????.
