12345678910111213141516171819202122232425262728293031323334353637 |
- <template>
- <span v-bind="$attrs" @click="btnClick"> 申请方案 </span>
- </template>
- <script>
- export default {
- name: "applyBtn",
- props: {
- myType: {
- type: String,
- default: 'kaoshi'
- },
- },
- methods: {
- // 判断是否为移动端
- isPC() {
- const browserWidth = document.documentElement.clientWidth;
- if (browserWidth <= 768) {
- return false;
- } else {
- return true;
- }
- },
- btnClick() {
- if (this.isPC()) {
- this.$emit('active-pc', this.myType)
- } else {
- this.$emit('active-h5', this.myType);
- }
- }
- }
- }
- </script>
- <style scoped>
- </style>
|