![](https://img-blog.csdnimg.cn/20201014180756925.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Vue
Vue示例
ACGuan
愿与世界IT技术爱好者共同学习,愿结交天下英雄好汉。
展开
-
Vue返回上一页保留数据
1.配置路由,代码如下export default new Router({ routes: [ { path: '/hello', name: 'HelloWorld', component: HelloWorld, meta: { keepAlive: true // 需要缓存 } }, { path: '/hello2', name: 'HelloWorld2',原创 2021-03-09 11:54:51 · 7528 阅读 · 0 评论 -
Uniapp 返回上一页传值案例
A页面onShow(){ var shequ = getCurrentPages(); var prevShequ = shequ[shequ.length - 1]; var brand = prevShequ.brand; console.log(brand)},B页面chooseBrand(item){ var shequ = getCurrentPages(); var prevShequ = shequ[shequ.length - 2]; pr原创 2021-02-24 17:46:47 · 1525 阅读 · 1 评论 -
Vue模块化自定义指令
1.创建directive.js文件,代码如下:import Vue from 'vue';Vue.directive('focus',{ //当绑定元素插入到DOM中 inserted: function(el){ el.focus(); //元素聚焦 el.setAttribute('placeholder','自定义内容'); }})Vue.directive('***',{ inserted: function(el){ //.... }}) export {原创 2021-01-15 14:44:29 · 304 阅读 · 1 评论 -
Vue父子组件生命周期
父beforeCreate->父created->父beforeMount->子beforeCreate->子created->子beforeMount->子mounted->父mounted原创 2021-01-15 15:49:39 · 119 阅读 · 0 评论 -
vue create 项目名字如何打包
1.创建vue.config.js文件,代码如下:module.exports = { // 选项... publicPath: './', publicPath: process.env.NODE_ENV === 'production' ? './' : '/', outputDir: 'dist', assetsDir: 'static'}//npm install -g @vue/cli-init2.执行npm run build...原创 2020-08-18 10:05:09 · 977 阅读 · 0 评论 -
微信小程序循环索引设置
<view class="shoppingLi" wx:for="{{shoppingArr}}" wx:for-item="item2" wx:for-index="index2"> </view>原创 2020-08-04 09:44:48 · 2065 阅读 · 1 评论 -
Vue实现升序降序
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>06_列表渲染_过滤与排序</title> <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script> </head> <.原创 2020-07-30 13:27:17 · 3893 阅读 · 0 评论 -
Vue刷新当前页面
App.vue注入以下代码,以下所示://APP.vue<template> <div id="app"> <router-view v-if="isRouterAlive"></router-view> </div></template><script>export default { name: 'App', provide(){ return { relo原创 2020-07-29 11:45:36 · 231 阅读 · 0 评论 -
Vue获取当前元素
<p @click = "clickfun($event)">点击</p><===================================>methods: { clickfun(e) { // e.target 是你当前点击的元素 // e.currentTarget 是你绑定事件的元素 #获得点击元素的前一个元素 e.currentTarget.previousElementSi.原创 2020-07-29 11:01:33 · 893 阅读 · 0 评论 -
实现购物车功能
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>Document</title> <style>.fl{ float: left;}.fr{ float: right;}blockquote, body, dd, div, dl, dt, fieldset, form, h1, h2, h3, h4, .原创 2020-07-07 15:16:03 · 241 阅读 · 0 评论 -
Vue全选示例
<div> <div> <input type="checkbox" @click="checkAll" v-model="checked"> <span>全选</span> </div> <ul> <li v-for="(item,index) in list" :key="index" style="margin-top:20px;"> <input type="checkbo.原创 2020-07-06 17:10:09 · 207 阅读 · 0 评论 -
Vue+webpack项目创建及环境配置
1.注册好github或码云帐号;2.电脑安装好git软件;3.注册好ssh密钥;4.将github或码云仓库的代码下载下来,步骤如下: (1).在cmd里输入git clonessh地址及密码,如图所示; (2).更改项目或添加文件; (3).git status查看更改过文件的状态,如图所示: (4).输入git add . ,如...原创 2019-12-25 17:09:03 · 2453 阅读 · 1 评论