动态立体盒子效果
JavaScript Code复制内容到剪贴板
- cnpm install animate.css --save
JavaScript Code复制内容到剪贴板
- <template>
- <div class="top" id="top">
- <div class="place exam-place" @click="selectType('exam',$store.state.common.publishExercise)"></div>
- <div class="place wechat-place" @click="selectType('wechat',$store.state.common.publishMicroLesson)"></div>
- <div class="place survey-place" @click="selectType('survey',$store.state.common.publishQuestionnaire)"></div>
- <div class="place outline-place" @click="selectType('outline',$store.state.common.publishActivity)"></div>
- <div class="place live-place" @click="selectType('live',$store.state.common.publishLive)"></div>
- <div class="place download-place" @click="selectType('download')"></div>
- </div>
- <div class="btn-group" id="btn-group">
- <button @click="publishArticle(publishType,2)">免费发布</button>
- <button @click="publishArticle(publishType,1)">付费发布</button>
- </div>
- </template>
- <script>
- import animate from 'animate.css'
- export default {
- name: 'publish',
- data: function() {
- return {
- scaleLock: true,
- createNum: 0,
- scaleTimes: 1,
- clickType: ""
- }
- },
- methods: {
- selectType(clickType, type) {
- this.clickType = clickType;
- // if(clickType != 'download') {
- // this.publishType = type;
- // }
- if(this.createNum == 0) {
- for(var i = 1; i < 5; i++) {
- var imgBtn = document.createElement('img');
- var topEl = document.getElementById("top");
- imgBtn.src = "../static/images/" + clickType + "/" + i + ".png";
- this.setStyle(imgBtn, {
- width: "100%",
- height: "100%",
- display: "none",
- position: 'absolute',
- top: 0,
- left: 0,
- });
- topEl.appendChild(imgBtn);
- }
- this.createNum = 1;
- }
- //判断放大还是缩小
- if(this.scaleLock) {
- this.scaleBigEffect();
- this.scaleLock = false;
- } else {
- this.scaleSmallEffect();
- this.scaleLock = true;
- }
- },
- },
- }
- </script>
- <style>
- </style>