feat: 实现一个scss转css的实时预览工具,用于scss学习

master
LCJ-MinYa 5 months ago
parent e173a00bb5
commit 0061afe0ff

@ -114,6 +114,10 @@ const titleArr = [
key: 'blockAllAction',
title: '阻止页面所有操作',
},
{
key: 'scssLiveTranslate',
title: 'SCSS → CSS 实时翻译器',
},
];
// @/views/demo/**/*.vue

@ -179,9 +179,8 @@
</template>
<script setup lang="ts">
import { ref, reactive, computed, onMounted } from 'vue';
import { ref, computed, onMounted } from 'vue';
import { ElMessage, ElMessageBox } from 'element-plus';
import { Edit } from '@element-plus/icons-vue';
// ---- State ----
const scss = ref<string>(`$primary: #3490dc;
@ -307,7 +306,7 @@ async function ensureSass() {
try {
await new Promise((resolve, reject) => {
const script = document.createElement('script');
script.src = 'https://cdn.jsdelivr.net/npm/sass.js@0.11.1/dist/sass.sync.js';
script.src = './sass.sync.js';
script.onload = () => resolve();
script.onerror = (e) => reject(new Error('Sass.js failed to load'));
document.head.appendChild(script);

File diff suppressed because one or more lines are too long

@ -57,7 +57,7 @@
<script setup>
import { ref, computed } from 'vue';
import { Search, Warning, Sunny, Moon, FullScreen, Printer, Picture } from '@element-plus/icons-vue';
import { Search, Warning, Sunny, Moon, FullScreen, Printer, Picture, Switch } from '@element-plus/icons-vue';
//
const isDarkTheme = ref(false);
@ -75,6 +75,7 @@ const navItems = ref([
{ icon: Picture, name: 'HTML转图片', url: '/#/htmlToImg' },
{ icon: Picture, name: '图片压缩', url: '/#/demo/compressImage' },
{ icon: Picture, name: '图片标注', url: '/#/demo/tuiImageEditor' },
{ icon: Switch, name: 'SCSS转换', url: '/#/demo/scssLiveTranslate' },
]);
//

Loading…
Cancel
Save