| | |
| | | :key="index" |
| | | :class="{ active: toolSelected === item.name }" |
| | | :title="item.title" |
| | | @click="onChangeTool(item.name)" |
| | | @click="onChangeTool(item.name, index)" |
| | | :style="{ boxShadow: index == num ? '0 0 15px #00ccff' : '' }" |
| | | > |
| | | <i :class="['iconfont', item.icon]"></i> |
| | | <img |
| | | :src="item.icon" |
| | | alt="" |
| | | class="giaffiti-btn" |
| | | :style="{ width: index == 0 ? '18px' : '' }" |
| | | /> |
| | | </button> |
| | | </div> |
| | | </template> |
| | |
| | | default: "brush", |
| | | }, |
| | | }, |
| | | computed:{ |
| | | computed: { |
| | | toolSelected() { |
| | | return this.tool |
| | | } |
| | | return this.tool; |
| | | }, |
| | | }, |
| | | data() { |
| | | return { |
| | | toolList: [ |
| | | { name: "brush", title: "画笔", icon: "icon-qianbi" }, |
| | | { name: "eraser", title: "橡皮擦", icon: "icon-xiangpi" }, |
| | | { name: "clear", title: "清空", icon: "icon-qingchu" }, |
| | | { name: "undo", title: "撤销", icon: "icon-chexiao" }, |
| | | { name: "save", title: "保存", icon: "icon-fuzhi" }, |
| | | { |
| | | name: "brush", |
| | | title: "画笔", |
| | | icon: require("@/assets/images/brush.png"), |
| | | }, |
| | | { |
| | | name: "eraser", |
| | | title: "橡皮擦", |
| | | icon: require("@/assets/images/rubber.png"), |
| | | }, |
| | | { |
| | | name: "clear", |
| | | title: "清空", |
| | | icon: require("@/assets/images/scrub.png"), |
| | | }, |
| | | { |
| | | name: "undo", |
| | | title: "撤销", |
| | | icon: require("@/assets/images/revoke.png"), |
| | | }, |
| | | { |
| | | name: "save", |
| | | title: "保存", |
| | | icon: require("@/assets/images/save.png"), |
| | | }, |
| | | ], |
| | | num: 0, |
| | | }; |
| | | }, |
| | | methods: { |
| | | onChangeTool(tool) { |
| | | onChangeTool(tool, index) { |
| | | if (index == 0 || index == 1) this.num = index; |
| | | this.$emit("change-tool", tool); |
| | | }, |
| | | }, |
| | |
| | | </script> |
| | | |
| | | <style scoped> |
| | | .tools { |
| | | display: flex; |
| | | align-items: center; |
| | | } |
| | | .tools button { |
| | | /* border-radius: 50%; */ |
| | | width: 32px; |
| | |
| | | .tools button i { |
| | | font-size: 20px; |
| | | } |
| | | .giaffiti-btn { |
| | | width: 24px; |
| | | } |
| | | </style> |