idahogurl / vs-code-prettier-eslint

A Visual Studio Code Extension to format JavaScript and TypeScript code using the prettier-eslint package.
MIT License
185 stars 46 forks source link

vue file two script error #145

Closed guohuihot closed 1 year ago

guohuihot commented 1 year ago

image

image

idahogurl commented 1 year ago

@guohuihot Could I get a small reproduction repo? In addition to this code you pasted above, it needs to include your ESLint, Prettier, TypeScript configs as well as your package.json.

guohuihot commented 1 year ago
<template>
  <view class="header">
    <view class="header-bg" :style="cHeaderStyle">
      <uni-nav-bar
        :title="title"
        left-icon="left"
        background-color="#0fcdc1"
        color="#fff"
        :border="false"
        @clickLeft="Util.navigateBack()"
      />
      <slot name="row" />
    </view>
    <view
      class="header-card"
      :style="{ height: cardHeight + 'px', marginTop: -cardHeight / 2 + 'px' }"
    >
      <slot name="card" />
    </view>
    <slot />
  </view>
</template>

<script setup lang="ts">
import { reactive, watch, computed, } from 'vue'
const props = defineProps({
  title: {
    type: String,
    default: '标题',
  },
  headerStyle: {
    type: Object,
    default() {
      return {}
    },
  },
  cardHeight: {
    type: [Number,],
    default: 80,
  },
})

const cHeaderStyle = computed(() => {
  return {
    paddingBottom: props.cardHeight / 2 + 'px',
    minHeight: '120px',
    ...props.headerStyle,
  }
})
</script>

<script lang="ts">
export default{
  options: {
    styleIsolation: 'isolated', // 组件样式隔离 isolated 互不影响 apply-shared页面影响组件  share互相影响
    multipleSlots: true, //为true时才能使用具名插槽
    // addGlobalClass: true,
    virtualHost: true,
  },
}
</script>
<style lang="scss" scoped></style>
guohuihot commented 1 year ago

Error when there are two scripts

idahogurl commented 1 year ago

@guohuihot I cannot reproduce the issue. Have you looked at the example project for Vue with TypeScript? https://github.com/idahogurl/vs-code-prettier-eslint/tree/master/examples/typescript-vue

github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 14 days with no activity.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 14 days since being marked as stale.